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: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dyeldandi at gramant dot ru
New email:
PHP Version: OS:

 

 [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)

Pull Requests

Pull requests:

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 14:01:29 2024 UTC