php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: michiel at boland dot org
New email:
PHP Version: OS:

 

 [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 commitsRelated reports
 [2007-02-15 12:34 UTC] dmitry@php.net
Fixed in CVS HEAD and PHP_5_2.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 10:01:29 2024 UTC