|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69860 php-fpm process accounting is broken with keepalive
Submitted: 2015-06-17 10:58 UTC Modified: -
Avg. Score:4.7 ± 0.7
Reproduced:6 of 6 (100.0%)
Same Version:3 (50.0%)
Same OS:5 (83.3%)
From: dyeldandi at gramant dot ru Assigned:
Status: Closed Package: FPM related
PHP Version: 5.5.26 OS: Linux (CentOS 6)
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.
Block user comment
Status: Assign to:
Bug Type:
From: dyeldandi at gramant dot ru
New email:
PHP Version: OS:


 [2015-06-17 10:58 UTC] dyeldandi at gramant dot ru
When php-fpm is used with keepalive (fastcgi_keep_conn on; in nginx) php-fpm starts killing workers (and slow-logging requests). That is happening because  proc->accepted is not updated when a new request is started in an existing connection. And this is because fpm_request_reading_headers() is not being called from fcgi_accept_request() (fastcgi.c line 806) when req->fd >= 0. 

So when a cumulative time of number of requests along with waiting time between requests exceed request_slowlog_timeout (configured in php-fpm.conf) php-fpm starts slow-logging requests and when it is higher than request_terminate_timeout a perfectly good worker gets killed.

This can be easily observed by configuring pm.status_path = /status and hitting http://localhost/status?full , request duration: for running requests becomes too large (accumulates) and never goes down unless worker gets killed. 

Proposed fix is to simply add fpm_request_reading_headers(); after 
if (fcgi_read_request(req)) {
in  fcgi_accept_request()


fpm-keepalive-accounting (last revision 2015-06-17 11:00 UTC by dyeldandi at gramant dot ru)

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-02-11 23:07 UTC]
Automatic comment on behalf of
Log: Fixed bug #69860
 [2017-02-11 23:07 UTC]
-Status: Open +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 18 00:01:32 2024 UTC