amphp / cluster

Building multi-core network applications with PHP.
MIT License
60 stars 9 forks source link

Lib Event error: event_base_loop can run on each event_base at once #10

Open PNixx opened 3 years ago

PNixx commented 3 years ago

Install library pecl install event Options:

Enable internal debugging in Event [no] :
Enable sockets support in Event [yes] :
libevent installation prefix [/usr] :
Include libevent's pthreads library and enable thread safety support in Event [no] :
Include libevent protocol-specific functionality support including HTTP, DNS, and RPC [yes] : no
Include libevent OpenSSL support [yes] : no
PHP Namespace for all Event classes [no] :
openssl installation prefix [no] :
% pecl list
Installed packages, channel pecl.php.net:
=========================================
Package   Version State
event     3.0.2r1 stable
imagick   3.4.4   stable
memcached 3.1.5   stable
raphf     2.0.1   stable
xdebug    2.8.0   stable
% ./bin/cluster -w 1 examples/hello-world.php
PHP Warning:  EventBase::loop(): event_base_loop: reentrant invocation.  Only one event_base_loop can run on each event_base at once. in /project/vendor/amphp/amp/lib/Loop/EventDriver.php on line 255
PHP Stack trace:
PHP   1. {main}() /project/vendor/amphp/parallel/lib/Context/Internal/process-runner.php:0
PHP   2. Amp\Parallel\Context\Internal\{closure:/project/vendor/amphp/parallel/lib/Context/Internal/process-runner.php:40-123}() /project/vendor/amphp/parallel/lib/Context/Internal/process-runner.php:123
PHP   3. Amp\Promise\wait() /project/vendor/amphp/parallel/lib/Context/Internal/process-runner.php:105
PHP   4. Amp\Loop::run() /project/vendor/amphp/amp/lib/functions.php:229
PHP   5. Amp\Loop\EventDriver->run() /project/vendor/amphp/amp/lib/Loop.php:95
PHP   6. Amp\Loop\EventDriver->run() /project/vendor/amphp/amp/lib/Loop/EventDriver.php:206
PHP   7. Amp\Loop\EventDriver->tick() /project/vendor/amphp/amp/lib/Loop/Driver.php:72
PHP   8. Amp\Loop\EventDriver->dispatch() /project/vendor/amphp/amp/lib/Loop/Driver.php:138
PHP   9. EventBase->loop() /project/vendor/amphp/amp/lib/Loop/EventDriver.php:255
PHP  10. Amp\Loop\EventDriver->Amp\Loop\{closure:/project/vendor/amphp/amp/lib/Loop/EventDriver.php:59-79}() /project/vendor/amphp/amp/lib/Loop/EventDriver.php:255
PHP  11. Amp\Socket\DnsConnector::Amp\Socket\{closure:/project/vendor/amphp/socket/src/DnsConnector.php:84-86}() /project/vendor/amphp/amp/lib/Loop/EventDriver.php:63
PHP  12. Amp\Deferred->resolve() /project/vendor/amphp/socket/src/DnsConnector.php:85
PHP  13. {anonymous-class:/project/vendor/amphp/amp/lib/Deferred.php:22-27}->resolve() /project/vendor/amphp/amp/lib/Deferred.php:52
PHP  14. Amp\Promise\{closure:/project/vendor/amphp/amp/lib/functions.php:279-284}() /project/vendor/amphp/amp/lib/Internal/Placeholder.php:149
PHP  15. Amp\Deferred->resolve() /project/vendor/amphp/amp/lib/functions.php:282
PHP  16. {anonymous-class:/project/vendor/amphp/amp/lib/Deferred.php:22-27}->resolve() /project/vendor/amphp/amp/lib/Deferred.php:52
PHP  17. Amp\Internal\PrivatePromise->onResolve() /project/vendor/amphp/amp/lib/Internal/Placeholder.php:143
PHP  18. {anonymous-class:/project/vendor/amphp/amp/lib/Deferred.php:22-27}->onResolve() /project/vendor/amphp/amp/lib/Internal/PrivatePromise.php:23
PHP  19. Amp\Coroutine->Amp\{closure:/project/vendor/amphp/amp/lib/Coroutine.php:91-148}() /project/vendor/amphp/amp/lib/Internal/Placeholder.php:46
PHP  20. Amp\Coroutine->resolve() /project/vendor/amphp/amp/lib/Coroutine.php:123
PHP  21. Amp\Coroutine->Amp\{closure:/project/vendor/amphp/amp/lib/Coroutine.php:91-148}() /project/vendor/amphp/amp/lib/Internal/Placeholder.php:149
PHP  22. Generator->send() /project/vendor/amphp/amp/lib/Coroutine.php:118
PHP  23. Amp\Cluster\Internal\{closure:/project/vendor/amphp/cluster/src/Internal/cluster-runner.php:13-63}() /project/vendor/amphp/amp/lib/Coroutine.php:118
PHP  24. Amp\Cluster\Internal\{closure:/project/vendor/amphp/cluster/src/Internal/cluster-runner.php:57-60}() /project/vendor/amphp/cluster/src/Internal/cluster-runner.php:60
PHP  25. require() /project/vendor/amphp/cluster/src/Internal/cluster-runner.php:59
PHP  26. Amp\Loop::run() /project/vendor/amphp/cluster/examples/hello-world.php:49
PHP  27. Amp\Loop\EventDriver->run() /project/vendor/amphp/amp/lib/Loop.php:95
PHP  28. Amp\Loop\EventDriver->run() /project/vendor/amphp/amp/lib/Loop/EventDriver.php:206
PHP  29. Amp\Loop\EventDriver->tick() /project/vendor/amphp/amp/lib/Loop/Driver.php:72
PHP  30. Amp\Loop\EventDriver->dispatch() /project/vendor/amphp/amp/lib/Loop/Driver.php:138
PHP  31. EventBase->loop() /project/vendor/amphp/amp/lib/Loop/EventDriver.php:255

On start with php ./examples/hello-world.php works correctly.