Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running cluster: The provided socket has already been closed #12

Open
prolic opened this issue Nov 1, 2022 · 3 comments
Open

Comments

@prolic
Copy link

prolic commented Nov 1, 2022

tested on latest commit: 9dd11ec

I have ext-sockets installed on PHP 8.1.12 (Alpine Linux 3.15 - docker)

php bin/node.php - runs the webserver successfully

php vendor/bin/cluster bin/node.php gives me this output (original is a bit longer, I just put here the important bits):

[2022-11-01T19:37:37.286526+00:00] cluster-2426.error: Worker 111 (PID 2652) died unexpectedly: The process stopped responding, potentially due to a fatal error or calling exit, restarting... {"id":111,"pid":2652} []
^C[2022-11-01T19:37:37.289365+00:00] cluster-2426.info: Stopping cluster due to received signal: 2 [] []
[2022-11-01T19:37:37.295714+00:00] cluster-2426.info: Worker 3 terminated cleanly {"id":3,"pid":2435} []
[2022-11-01T19:37:37.295854+00:00] cluster-2426.info: Worker 113 terminated cleanly {"id":113,"pid":2654} []
[2022-11-01T19:37:37.295951+00:00] cluster-2426.info: Worker 114 terminated cleanly {"id":114,"pid":2656} []
[2022-11-01T19:37:37.296109+00:00] cluster-2426.info: Worker 115 terminated cleanly {"id":115,"pid":2658} []
[2022-11-01T19:37:37.296226+00:00] cluster-2426.info: Worker 112 terminated cleanly {"id":112,"pid":2648} []
[2022-11-01T19:37:37.296351+00:00] cluster-2426.info: Worker 116 terminated cleanly {"id":116,"pid":2660} []
[2022-11-01T19:37:37.303222+00:00] cluster-2426.info: Started worker with ID 117 {"id":117,"pid":2662} []
[2022-11-01T19:37:37.303406+00:00] cluster-2426.info: Worker 117 terminated cleanly {"id":117,"pid":2662} []

Fatal error: Uncaught Amp\Socket\SocketException: The provided socket has already been closed in /var/www/vendor/amphp/cluster/src/Internal/TransferSocket.php:24
Stack trace:
#0 /var/www/vendor/amphp/cluster/src/StreamResourceSendPipe.php(26): Amp\Cluster\Internal\TransferSocket->__construct(Object(Amp\Socket\ResourceSocket))
#1 /var/www/vendor/amphp/cluster/src/ClusterSocketServerProvider.php(46): Amp\Cluster\StreamResourceSendPipe->__construct(Object(Amp\Socket\ResourceSocket), Object(Amp\Serialization\NativeSerializer))
#2 /var/www/vendor/amphp/cluster/src/Watcher.php(148): Amp\Cluster\ClusterSocketServerProvider->provideFor(Object(Amp\Socket\ResourceSocket))
#3 /var/www/vendor/amphp/amp/src/functions.php(34): Amp\Cluster\Watcher->Amp\Cluster\{closure}()
#4 /var/www/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(422): Amp\{closure}(NULL, NULL, Array)
#5 /var/www/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(612): Revolt\EventLoop\Internal\AbstractDriver->invokeMicrotasks()
#6 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#7 /var/www/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(494): Fiber->resume()
#8 /var/www/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(549): Revolt\EventLoop\Internal\AbstractDriver->invokeCallbacks()
#9 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#10 /var/www/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(83): Fiber->resume()
#11 /var/www/vendor/revolt/event-loop/src/EventLoop/Internal/DriverSuspension.php(95): Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#12 /var/www/vendor/amphp/amp/src/Future.php(247): Revolt\EventLoop\Internal\DriverSuspension->suspend()
#13 /var/www/vendor/amphp/cluster/src/Watcher.php(216): Amp\Future->await()
#14 /var/www/vendor/amphp/cluster/bin/cluster(254): Amp\Cluster\Watcher->join()
#15 /var/www/vendor/bin/cluster(120): include('/var/www/vendor...')
#16 {main}

Next Amp\Future\UnhandledFutureError: Unhandled future: Amp\Socket\SocketException: "The provided socket has already been closed"; Await the Future with Future::await() before the future is destroyed or use Future::ignore() to suppress this exception in /var/www/vendor/amphp/amp/src/Internal/FutureState.php:38
Stack trace:
#0 /var/www/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(422): Amp\Internal\FutureState->__destruct()
#1 /var/www/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(612): Revolt\EventLoop\Internal\AbstractDriver->invokeMicrotasks()
#2 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#3 /var/www/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(422): Fiber->throw(Object(Amp\Socket\SocketException))
#4 /var/www/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(612): Revolt\EventLoop\Internal\AbstractDriver->invokeMicrotasks()
#5 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#6 /var/www/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(422): Fiber->resume(NULL)
#7 /var/www/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(612): Revolt\EventLoop\Internal\AbstractDriver->invokeMicrotasks()
#8 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#9 /var/www/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(494): Fiber->resume()
#10 /var/www/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(549): Revolt\EventLoop\Internal\AbstractDriver->invokeCallbacks()
#11 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#12 /var/www/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(83): Fiber->resume()
#13 /var/www/vendor/revolt/event-loop/src/EventLoop/Internal/DriverSuspension.php(95): Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#14 /var/www/vendor/amphp/amp/src/Future.php(247): Revolt\EventLoop\Internal\DriverSuspension->suspend()
#15 /var/www/vendor/amphp/cluster/src/Watcher.php(216): Amp\Future->await()
#16 /var/www/vendor/amphp/cluster/bin/cluster(254): Amp\Cluster\Watcher->join()
#17 /var/www/vendor/bin/cluster(120): include('/var/www/vendor...')
#18 {main}

Next Revolt\EventLoop\UncaughtThrowable: Uncaught Amp\Future\UnhandledFutureError thrown in event loop callback Amp\Internal\FutureState::Amp\Internal\{closure} defined in /var/www/vendor/amphp/amp/src/Internal/FutureState.php:39; use Revolt\EventLoop::setErrorHandler() to gracefully handle such exceptions: Unhandled future: Amp\Socket\SocketException: "The provided socket has already been closed"; Await the Future with Future::await() before the future is destroyed or use Future::ignore() to suppress this exception in /var/www/vendor/revolt/event-loop/src/EventLoop/UncaughtThrowable.php:11
Stack trace:
#0 /var/www/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(397): Revolt\EventLoop\UncaughtThrowable::throwingCallback(Object(Closure), Object(Amp\Future\UnhandledFutureError))
#1 /var/www/vendor/revolt/event-loop/src/EventLoop/Internal/DriverSuspension.php(100): Revolt\EventLoop\Internal\AbstractDriver::Revolt\EventLoop\Internal\{closure}()
#2 /var/www/vendor/amphp/amp/src/Future.php(247): Revolt\EventLoop\Internal\DriverSuspension->suspend()
#3 /var/www/vendor/amphp/cluster/src/Watcher.php(216): Amp\Future->await()
#4 /var/www/vendor/amphp/cluster/bin/cluster(254): Amp\Cluster\Watcher->join()
#5 /var/www/vendor/bin/cluster(120): include('/var/www/vendor...')
#6 {main}
  thrown in /var/www/vendor/revolt/event-loop/src/EventLoop/UncaughtThrowable.php on line 11
@prolic
Copy link
Author

prolic commented Nov 1, 2022

Note: The exception message is only printed, after I stopped the cluster with CTRL+C. As long as this process keeps running I get lots of those Worker 426 (PID 3539) died unexpectedly: The process stopped responding, potentially due to a fatal error or calling exit, restarting... {"id":426,"pid":3539} []

@trowski
Copy link
Member

trowski commented Nov 8, 2022

Please run composer update to update to the latest Amp dependency betas and try again. There is a possibility the problem was fixed in amphp/parallel but was untagged.

@prolic
Copy link
Author

prolic commented Nov 8, 2022

@trowski thank you. I tried your suggestion, but I have same results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants