Closed akotulu closed 6 months ago
Hi akotulu, Thank you for your pr. But this pull request cannot be merged because it seems to have several bugs.
Thank you for the feedback. I will remove these modification and test again. I've implemented a Wrapper class on top of Workerman to handle different messages and communicate with other services. There are 3 Wrapper Workerman master instances in one server having single slave to transmit WS messages. In the future, these Wrappers can be installed on dedicated machines. Problem arouse using default PHP select
event. It occasionally received SIGPIPE and restarted the services. It may have been caused by Monit
tool watching over pm2
and pm2
actually running Wrapper instance. Both tools spam PID file every 10ms. Services worked as intended on Docker replica of production server, but when uploaded to actual server, nodes started to restart. I have disabled Monit
for now and using only pm2
. Service is running as it should without any restarts.
Also PHP's default select somehow runs out of FD indexes after two weeks (services need to be restarted), here is the error
Message: stream_select(): You MUST recompile PHP with a larger value of FD_SETSIZE.
It is set to 1024, but you have descriptors numbered at least as high as 7993.
--enable-fd-setsize=8192 is recommended, but you may want to set it
to equal the maximum number of open files supported by your system,
in order to avoid seeing this error again at a later date.
To fix it I've built a libevent
select library. Hope it will resolve the issue.
I will do a new pull request with only Log changes. It's really helpful to see when service restarted which Signal it received.
reinstallSignals
had duplicated code withinstallSignals
. There is no need to continue whenselect_stream
returns false, occasionally receivesSIGPIPE
which should be ignored. Addedpcntl_async_signals(true);
cause when running Workerman as a library, signals wont reach Workerman nor the master service wrapping Workerman. These code changes are in production environment, and service is now working without problems.