php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63395 Spawned processes do not perform
Submitted: 2012-10-30 10:20 UTC Modified: -
Votes:6
Avg. Score:4.0 ± 1.0
Reproduced:6 of 6 (100.0%)
Same Version:3 (50.0%)
Same OS:3 (50.0%)
From: Alex at phpguide dot co dot il Assigned:
Status: Open Package: FPM related
PHP Version: 5.4.8 OS: Ubuntu 12.04 x64
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-10-30 10:20 UTC] Alex at phpguide dot co dot il
Description:
------------
I'm running nginx 1.2.4 with php5-fpm (5.4.8) issuing

 ab -n 20000 -c 1000 http://localhost/index.php


When 

pm = dynamic
pm.max_children = 3000
pm.start_servers = 100  <- this is important
pm.max_spare_servers = 1000

I'm having a lot of errors in nginx talking to php


[error] 26125#0: *49177 upstream prematurely closed connection while reading 
response header from upstream, ... "fastcgi://127.0.0.1:9000"

[error] 26125#0: *56030 recv() failed (104: Connection reset by peer) while 
reading response header from upstream, ... upstream: "fastcgi://127.0.0.1:9000"


The fpm log shows a lot of 

WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or 
pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and X total 
children


When spawning new children reaches a concrete amount nginx stops issuing such 
errors. This leads me to believe freshly spawned processes do not execute and 
respond correctly.


Now, when I start with 3000 children straight ahead, all connections work 
properly. No errors in nginx or fpm.

pm = dynamic
pm.max_children = 3000
pm.start_servers = 3000  <- Straight ahead
pm.max_spare_servers = 3000

Test script:
---------------
The php code on the server is relatively simple.

apc_inc('count111'); sleep(1); echo 'x';


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-13 09:50 UTC] php-bugs at puzzled dot xs4all dot nl
This bug seems similar to https://bugs.php.net/bug.php?id=60961
 [2014-04-15 07:39 UTC] roger dot qiu at polycademy dot com
Yep this is definitely a bug. I experienced the same thing.

Basically if you have NGINX with upstream keepalive, and if this number is > than the pm.max_children in FPM, then what happens is that, if there is a X amount of concurrent requests (from for example Apache Bench), in which X is greater than the pm.max_children, this will result in Apache Bench freezing and sometimes never completing certain requests.

If the keepalive number is lower than the max_children (not equal), this problem then doesn't exist.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 10:03:03 2014 UTC