Bug #60961 [PATCH]: Graceful Restart (USR2) isn't very graceful

From: Date: Thu, 03 Oct 2019 11:43:01 +0000
Subject: Bug #60961 [PATCH]: Graceful Restart (USR2) isn't very graceful
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223020@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60961&edit=1

 ID:                 60961
 Patch added by:     mike@php.net
 Reported by:        phpbugs at oops dot mooo dot com
 Summary:            Graceful Restart (USR2) isn't very graceful
 Status:             Open
 Type:               Bug
 Package:            FPM related
 Operating System:   Debian Squeeze
 PHP Version:        7.0
 Block user comment: N
 Private report:     N

 New Comment:

The following pull request has been associated:

Patch Name: php-fpm: graceful restart without blocking/losing requests
On GitHub:  https://github.com/php/php-src/pull/3758
Patch:      https://github.com/php/php-src/pull/3758.patch


Previous Comments:
------------------------------------------------------------------------
[2018-08-23 15:33:04] danny dot kopping at hetzner dot co dot za

Hi

We have been experiencing this issue for a while, and after some investigation - we think we have
isolated the issue.

This is how we understand it:
When FPM receives a USR2 signal, it attempts to wait for its children to finish processing, and then
sends a QUIT signal to each child. If a child does not respond in the amount of time defined in
"process_control_timeout" then the master process sends a TERM.

Now, while FPM is waiting for its children to terminate, it goes into a "reloading" state,
it would seem. It prints the message "Reloading in progress ..." to its log. During this
time, one can send as many USR2 signals to the master process as one likes - it will not cause any
problems. However, if one sends a USR2 signal after the
execvp("/usr/sbin/php-fpm7.1", {"/usr/sbin/php-fpm7.1",
"--nodaemonize", "--fpm-config",
"/etc/php/7.1/fpm/php-fpm.conf"}) syscall and before receiving the "fpm is
running, pid xxx" log entry - then it will crash the master process and consequently all the
children.

Our suspicion is that the signal handling is buggy between startup time and moving into the
"ready to accept connections" state (without looking at the source).

------------------------------------------------------------------------
[2018-07-01 08:35:49] i at xstudio dot me

mark!

------------------------------------------------------------------------
[2017-11-30 17:17:14] federico dot omoto at gmail dot com

And this is also affecting the recently released PHP 7.2.0.
Is this bug expected to be fixed in the short term?

------------------------------------------------------------------------
[2017-10-21 16:11:04] luke at viovet dot co dot uk

This is also affecting PHP 7.1 on Ubuntu 14.04 and 16.04. Please fix asap.

------------------------------------------------------------------------
[2017-01-26 11:05:33] albertcasademont at gmail dot com

Yes please, a graceful reload is needed urgently. And more generally, php-fpm needs some love

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=60961


--
Edit this bug report at https://bugs.php.net/bug.php?id=60961&edit=1


Thread (16 messages)

« previous php.bugs (#223020) next »