From: michiel at boland dot org Operating system: Solaris PHP version: 5.2.0 PHP Bug Type: CGI related Bug description: endless fork() loop when running fastcgi
Description: ------------ PHP running as fastcgi under apache2, with PHP_FCGI_CHILDREN set to 2. Under certain circumstances, the parent PHP process keeps forking off child processes that exit immediately. This goes on forever, until the parent is killed. When I run a debugger, the in_shutdown variable (in sapi/cgi/fastcgi.c) is set to 1. This causes fcgi_accept_request, which is called in child processes, to return immediately. The only place where in_shutdown can be set is in the SIGTERM signal handler, fcgi_signal_handler. The fcgi_signal_handler is installed in fcgi_init, which is called via fcgi_is_fastcgi, right after entry into main(). Later on in cgi_main.c, a new SIGTERM handler is installed. (line 1334) If a SIGTERM signal arrives in the window of time between fcgi_init and the setting of the new signal handler, the loop describe above will occur. As a fix I would suggest blocking SIGTERM in main() until after the new handler is in place. Reproduce code: --------------- n/a -- Edit bug report at http://bugs.php.net/?id=40414&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40414&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40414&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40414&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40414&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40414&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40414&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40414&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40414&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40414&r=support Expected behavior: http://bugs.php.net/fix.php?id=40414&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40414&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40414&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40414&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40414&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40414&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40414&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40414&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40414&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40414&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40414&r=mysqlcfg
