Bug #78405 [PATCH]: FPM with keepalive: Kills worker when no request is seen for $terminate_timeout
| From: | sjon@php.net | Date: | Wed, 02 Mar 2022 09:51:12 +0000 |
| Subject: | Bug #78405 [PATCH]: FPM with keepalive: Kills worker when no request is seen for $terminate_timeout | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-240098@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78405&edit=1
ID: 78405
Patch added by: sjon@php.net
Reported by: sjon@php.net
Summary: FPM with keepalive: Kills worker when no request is
seen for $terminate_timeout
Status: Verified
Type: Bug
Package: FPM related
Operating System: archLinux
PHP Version: 8.1.3
Block user comment: N
Private report: N
New Comment:
The following pull request has been associated:
Patch Name: Fix #78405: FPM with keepalive kills workers after $terminate_timeout
On GitHub: https://github.com/php/php-src/pull/8163
Patch: https://github.com/php/php-src/pull/8163.patch
Previous Comments:
------------------------------------------------------------------------
[2022-02-28 10:46:21] cmb@php.net
@sjon, if you find some time, please submit a pull request, since
patches are often overlooked.
------------------------------------------------------------------------
[2022-02-25 14:53:55] sjon@php.net
The following patch has been added/updated:
Patch Name: only-terminate-workers-that-are-actually-running-code
Revision: 1645800835
URL: https://bugs.php.net/patch-display.php?bug=78405&patch=only-terminate-workers-that-are-actually-running-code&revision=1645800835
------------------------------------------------------------------------
[2022-02-25 14:33:32] sjon@php.net
I found #69860 which clarified some things. The fact that the timestamps in the logs differ
(execution timed out 5.xx sec vs SIGTERM after xxx sec) hint at a different issue:
* an fpm worker is spawned, and handles a req, remains running due to keepalive
* every time a new request is send over this connection, proc.accepted is reSET
* if no request is sent for $terminate_timeout, fpm kills the worker
while it is arguable workers also need some form of timeout to prevent exhaustion, I'm not sure
the same $terminate_timeout should be applied here. While 5s is a reasonable value to kill a hanging
script (for us) it is not reasonable to expect at least one request for every worker at least every
$terminate_timeout. Imo a different timeout should apply
------------------------------------------------------------------------
[2022-02-25 09:16:47] sjon@php.net
still an issue with latest php, and it's definitely caused by fastcgi_keep_conn being enabled
------------------------------------------------------------------------
[2019-09-24 08:59:43] sjon@php.net
This might be "caused" by fastcgi_keep_conn being enabled. Possibly fpm keeps the child
running due to keepalive being enabled but the master doesn't realize this and kills the child
thinking it is timing out. Should this work or should this become a feature request?
See also https://stackoverflow.com/a/51457613/3749523
------------------------------------------------------------------------
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=78405
--
Edit this bug report at https://bugs.php.net/bug.php?id=78405&edit=1