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: 2021-12-09 22:16 UTC
Votes:13
Avg. Score:4.4 ± 0.9
Reproduced:13 of 13 (100.0%)
Same Version:3 (23.1%)
Same OS:3 (23.1%)
From: Alex at phpguide dot co dot il Assigned: bukka (profile)
Status: Closed Package: FPM related
PHP Version: 5.4.8 OS: Ubuntu 12.04 x64
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: Alex at phpguide dot co dot il
New email:
PHP Version: OS:

 

 [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

Pull Requests

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.
 [2017-11-30 17:19 UTC] federico dot omoto at gmail dot com
This is a really old bug that is affecting PHP versions <= 7.2.0.
Can we expect it to be fixed soon?
 [2021-12-09 22:16 UTC] bukka@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: bukka
 [2021-12-09 22:16 UTC] bukka@php.net
There's no a configuration option pm.max_spawn_rate (introduced in PHP 8.1) that allows customizing the rate and preventing this problem. Please see more details in https://github.com/php/php-src/pull/6753
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 28 18:01:28 2024 UTC