-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix FPM timer event re-registration #4465
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
Conversation
192f374
to
3998723
Compare
My manual tests specific to #4460 ("'break' outside of not in the 'loop' or 'switch' contex" and |
@@ -627,7 +627,7 @@ class Tester | |||
$read = [$this->outDesc]; | |||
$write = null; | |||
$except = null; | |||
if (stream_select($read, $write, $except, 2 )) { | |||
if (stream_select($read, $write, $except, 3)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does it need to be increased?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test case waits one second after sigquit to send sigterm and another second after that to send sigkill, so we need to wait for two seconds for the reload to occur. So the timeout should be larger than two seconds.
I like it from the quick look. Not sure if it can have any side effects atm. I would be fine with this going to 7.4 and if it's all good, we could back-port it eventually. |
Postpone signal delivery while spawning children. Prevent the following case: - Reload (reexec) is in progress. - New master is forking to start enough children for pools where `pm` is not `on-demand`. - Another `SIGUSR2` is received by the master process. - Master process switches to reloading state. - Some child has not set its own signal handlers. - `SIGQUIT` and `SIGTERM` sent by master process are caught by signal handler set by master process and so they are ignored. - A child is running, it has no reason to finish Before pull request php#4465 this scenario could cause deadlock, however with 0ed6c37 reload finishes after `SIGKILL`. Use sigprocmask() around fork() to avoid race of delivery signal to children and setting of own signal handlers. Fixes bug #76601
Postpone signal delivery while spawning children. Prevent the following case: - Reload (reexec) is in progress. - New master is forking to start enough children for pools where `pm` is not `on-demand`. - Another `SIGUSR2` is received by the master process. - Master process switches to reloading state. - Some child has not set its own signal handlers. - `SIGQUIT` and `SIGTERM` sent by master process are caught by signal handler set by master process and so they are ignored. - A child is running, it has no reason to finish Before pull request #4465 this scenario could cause deadlock, however with 0ed6c37 reload finishes after `SIGKILL`. Use sigprocmask() around fork() to avoid race of delivery signal to children and setting of own signal handlers. Fixes bug #76601
Make sure that fpm_event_add calls inside a timer callback work by unregistering the event from the queue before invoking its callback.
This is an alternative fix for #4460.