|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
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
PHP running as fastcgi under apache2, with

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

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:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-15 12:34 UTC]
Fixed in CVS HEAD and PHP_5_2.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 22:01:31 2024 UTC