kakserpom / phpdaemon

Asynchronous server-side framework for network applications implemented in PHP using libevent
http://daemon.io/
GNU Lesser General Public License v3.0
1.53k stars 231 forks source link

master thread crash in start mode #171

Closed hitsmaxft closed 10 years ago

hitsmaxft commented 10 years ago

phpinfo https://gist.github.com/hitsmaxft/9566158

repruduction steps

~ php bin/sampleapp start

[PHPD] Loaded config file: '/Volumes/SourceCode/opensource/phpdaemon/conf/phpd-sampleapp.conf'
[PHPD] Loaded config file: 'conf/conf.d/ExampleJabberBot.conf'
[PHPD] Loaded config file: 'conf/conf.d/FastCGI.conf'
[PHPD] Loaded config file: 'conf/conf.d/FlashpolicyServer.conf'
[PHPD] Loaded config file: 'conf/conf.d/HTTPServer.conf'
[PHPD] Loaded config file: 'conf/conf.d/IdentServer.conf'
[PHPD] Loaded config file: 'conf/conf.d/SSL-sample.conf'
[PHPD] Loaded config file: 'conf/conf.d/WebSocketServer.conf'
[PHPD] M#96698 Unexcepted shutdown.
[PHPD] W#96700 \PHPDaemon\Clients\WebSocket\Example up.
[PHPD] PHPDaemon\Clients\WebSocket\Example: Got frame: foobar

~ php bin/sampleapp stop

[PHPD] Loaded config file: '/Volumes/SourceCode/opensource/phpdaemon/conf/phpd-sampleapp.conf'
[PHPD] Loaded config file: 'conf/conf.d/ExampleJabberBot.conf'
[PHPD] Loaded config file: 'conf/conf.d/FastCGI.conf'
[PHPD] Loaded config file: 'conf/conf.d/FlashpolicyServer.conf'
[PHPD] Loaded config file: 'conf/conf.d/HTTPServer.conf'
[PHPD] Loaded config file: 'conf/conf.d/IdentServer.conf'
[PHPD] Loaded config file: 'conf/conf.d/SSL-sample.conf'
[PHPD] Loaded config file: 'conf/conf.d/WebSocketServer.conf'
[WARN]. It seems that phpDaemon is not running (PID 96698).

bugfix 1ab80b94d2334e80bc76334372c81af30be3d0c3

kakserpom commented 10 years ago

I can not reproduce this bug. Your "bugfix" is not real bug fix, because event base should not be created there, since Master is going to fork processes and libevent is unstable in this situation. Master works fine without libevent.

Unexcepted shutdown.

It means that register_shutdown_function triggered in Master without normal exit. Usually it happens when Fatal error occurs in Master. Please turn on php error logs and investigate why it happens to your master process.

Since adding that eventBase line to the master makes it working, I think the problem is the signal handling without libevent, try to look there. Also, if you could give me shell access to machine where I can reproduce this bug I would be happy to investigate it myself. My public key: http://root.loopback.su/authorized_keys

hitsmaxft commented 10 years ago

I found it was caused by pcntl extension of php builded by homebrew, on mac. I'm on process of rebuild php. Thank you for your review and your patience.

kakserpom commented 10 years ago

With your changes of composer, packagist says it became wrong. "It is recommended that you use composer validate to check for errors when you change your composer.json."