Bug #69860 [Opn->Csd]: php-fpm process accounting is broken with keepalive

From: Date: Sat, 11 Feb 2017 23:07:16 +0000
Subject: Bug #69860 [Opn->Csd]: php-fpm process accounting is broken with keepalive
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207275@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69860&edit=1

 ID:                 69860
 Updated by:         nikic@php.net
 Reported by:        dyeldandi at gramant dot ru
 Summary:            php-fpm process accounting is broken with keepalive
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            FPM related
 Operating System:   Linux (CentOS 6)
 PHP Version:        5.5.26
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[2015-06-17 10:58:40] 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()



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=69860&edit=1


Thread (2 messages)

« previous php.bugs (#207275) next »