|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #78413 request_terminate_timeout does not take effect after fastcgi_finish_request
Submitted: 2019-08-14 00:32 UTC Modified: -
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: rs dot orlov at gmail dot com Assigned:
Status: Closed Package: FPM related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
17 - 12 = ?
Subscribe to this entry?

 [2019-08-14 00:32 UTC] rs dot orlov at gmail dot com
Hi there.

It is common practice to call fastcgi_finish_request as soon as response is ready to be sent and defer some heavy load tasks after that. But here is the problem: process will no longer be terminated if it exceeds request_terminate_timeout.

It happens because fpm_request_finished called inside fastcgi_finish_request changes request state to FPM_REQUEST_FINISHED. But fpm_request_check_timed_out only checks processes being in state between FPM_REQUEST_ACCEPTING and FPM_REQUEST_END.

Turns out that there is no way to limit execution time of a worker after fastcgi_finish_request. That behavior may lead to all fpm-pool being occupied.

Possible solution may be a config option which enables fpm_request_check_timed_out for processes in FPM_REQUEST_FINISHED state,

Test script:


$time = microtime(true);
// must be any time greater than configured request_terminate_timeout
$delaySec = 10;

while ($delaySec > (microtime(true) - $time)) {

Expected result:
Php worker being terminated by fpm after %request_terminate_timeout% of execution time


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-08-28 04:56 UTC] turchanov at farpost dot com
The following pull request has been associated:

Patch Name: Fix #78413: php-fpm request_terminate_timeout does not take effect af…
On GitHub:
 [2019-09-30 10:55 UTC]
Automatic comment on behalf of
Log: Fix #78413: php-fpm request_terminate_timeout does not take effect after fastcgi_finish_request
 [2019-09-30 10:55 UTC]
-Status: Open +Status: Closed
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Nov 30 16:01:29 2023 UTC