Bug #69724 [NEW]: pm.ondemand forks fewer child workers than it should
| From: | barry at jaspan dot org | Date: | Thu, 28 May 2015 23:10:17 +0000 |
| Subject: | Bug #69724 [NEW]: pm.ondemand forks fewer child workers than it should | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-192982@lists.php.net to get a copy of this message | ||
From: barry at jaspan dot org
Operating system: Linux
PHP version: 5.5.25
Package: FPM related
Bug Type: Bug
Bug description:pm.ondemand forks fewer child workers than it should
Description:
------------
The FPM pm.ondemand process manager has a subtle bug in the way it uses
edge-triggered polling (with epoll() or kqueue()) that causes it not to
notice when multiple requests arrive at the same time, and thus not to
fork the appropriate number of children to handle them. The bug was
introduced during pm.ondemand's initial development, when the author
switched from level-triggered select/poll to edge-triggered epoll/kqueue
in order to a different bug that resulted in the fpm parent process
entering a cpu spin loop for brief periods when new requests arrived.
The details of the bug are too subtle to fully describe here. However,
the PR I am about to submit for this bug report contains a new DESIGN.md
file that includes a thorough explanation.
Test script:
---------------
I do not know how to create a self-contained test case for this.
However, using a custom web-testing tool I wrote called Goofy
(https://github.com/bjaspan/goofy), it is easy to reproduce. The README
file in that repo shows using Goofy to demonstrate the exact bug in FPM
that I am reporting here.
Expected result:
----------------
When N requests arrive nearly simultaneously, and FPM is allowed to fork
N more processes, it should fork N more processes.
Actual result:
--------------
When N requests arrive nearly simultaneously, and FPM is allowed to fork
N more processes, it almost always forks fewer than N processes, usually
a lot fewer. The exact number depends on race conditions with the fpm
parent, children, epoll in the kernel, and who knows what else.
--
Edit bug report at https://bugs.php.net/bug.php?id=69724&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69724&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69724&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69724&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69724&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69724&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69724&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69724&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69724&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69724&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69724&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69724&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69724&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69724&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69724&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69724&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69724&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69724&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69724&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69724&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69724&r=mysqlcfg