endless fork() loop when running fastcgi
| Bug #40414 | endless fork() loop when running fastcgi | ||||
|---|---|---|---|---|---|
| Submitted: | 2007-02-09 10:09 UTC | Modified: | 2007-02-15 12:34 UTC | ||
| From: | michiel at boland dot org | Assigned: | dmitry (profile) | ||
| Status: | Closed | Package: | CGI/CLI related | ||
| PHP Version: | 5.2.0 | OS: | Solaris | ||
| Private report: | No | CVE-ID: | None | ||
[2007-02-09 10:09 UTC] 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
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits