#40414 [Opn->Asn]: endless fork() loop when running fastcgi
| From: | tony2001@php.net | Date: | Fri, 09 Feb 2007 10:22:47 +0000 |
| Subject: | #40414 [Opn->Asn]: endless fork() loop when running fastcgi | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-108619@lists.php.net to get a copy of this message | ||
ID: 40414
Updated by: tony2001@php.net
Reported By: michiel at boland dot org
-Status: Open
+Status: Assigned
Bug Type: CGI related
Operating System: Solaris
PHP Version: 5.2.0
-Assigned To:
+Assigned To: dmitry
Previous Comments:
------------------------------------------------------------------------
[2007-02-09 10:09:13] michiel at boland dot org
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 this bug report at http://bugs.php.net/?id=40414&edit=1