php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #75440 Fpm reload should be graceful, not killing running processes
Submitted: 2017-10-25 13:43 UTC Modified: -
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:2 (66.7%)
From: sjon at hortensius dot net Assigned:
Status: Open Package: FPM related
PHP Version: Irrelevant OS: linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: sjon at hortensius dot net
New email:
PHP Version: OS:

 

 [2017-10-25 13:43 UTC] sjon at hortensius dot net
Description:
------------
When fpm receives a USR2 (reload) signal it should reload it's configuration. 

However, it currently also kills existing connections / and/or refuses to accept new connections for a short period. This results in errors suchs as 'connect() failed (111: Connection refused) while connecting to upstream' in my nginx logs.

Executing a reload should be more graceful, not throwing any errors or refusing connections and behave like `nginx -s reload`


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-04-10 09:27 UTC] pietro at dkremoto dot it
I've done some other test for this specific bug and I've discovered more,


If i do something like this 
-----------------------------
<?php
$start = time();
sleep(20);
echo "Execution time: ".(time()-$start)."s";
?>

and then i reload fpm, the script’s execution will stop immediately reporting the execution time elapsed form the launch of the script and the fpm reload


Else if i do something like that:
-----------------------------
<?php
$start = time();
for($i=0; $i<20; $i++) {
	sleep(1);
}
echo "Execution time: ".(time()-$start)."s";
?>

and reload FPM, he won’t be serve any other request for the amount of seconds of the cicle, (20 sec) but will terminate the execution of the script correctly.
The most terrifying thing is that if I have this kind of cicle with heavy computation and I launch a reload, all the websites under the pool will be unreachable until the script with the heavy cicle will finish.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 02:01:30 2024 UTC