php.net |  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: -
Votes:6
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:
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:
MUST BE VALID
Solve the problem:
47 - 14 = ?
Subscribe to this entry?

 
 [2015-06-17 10:58 UTC] dyeldandi at gramant dot ru
Description:
------------
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()


Patches

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

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-02-11 23:07 UTC] nikic@php.net
Automatic comment on behalf of dyeldandi@gramant.ru
Revision: http://git.php.net/?p=php-src.git;a=commit;h=9814be4bc28892d1e0a5dc875fef0b4bde455d23
Log: Fixed bug #69860
 [2017-02-11 23:07 UTC] nikic@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Wed Aug 23 13:01:41 2017 UTC