PHP fastcgi with PHP_FCGI_CHILDREN doesn't kill children when parent is killed
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
php |
Unknown
|
Unknown
|
|||
Debian |
Fix Released
|
Unknown
|
|||
php5 (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
This Bug is already reported here: http://
and here: http://
I see it in Ubuntu Hardy now:
PHP 5.2.4-2ubuntu5 with Suhosin-Patch 0.9.6.2 (cgi-fcgi)
Quoting from: http://
When running PHP in FastCGI mode with a fastCGI apache module (such a
mod_fcgid), all is running fine when PHP_FCGI_CHILDREN unset : only 1
process spawned. When using PHP_FCGI_
forks n childs, and the parent acts as a manager between the child
processes, wait()ing to respawn them if they are killed or exit. The
problem happens when the FastCGI process manager handled by the apache
module has to kill the parent PHP process (it only knows the parent's
PID) for any reason such as idle timeout, max lifetime, etc.
Problem:
While the PHP parent process is properly killed by the FastCGI process
manager, the children aren't killed, but instead stay alive, waiting for
a new request which will never come.
This sooner or later uses up all availible RAM and lead to a DOS.
Workaround: See comments.
description: | updated |
Changed in php: | |
importance: | Undecided → Unknown |
status: | New → Unknown |
Changed in debian: | |
status: | Confirmed → Fix Released |
Workaround: Kill those lurking process regularily using a cronjob.
This works for me, it should be reasonably safe to use (who has php started by init?).
#!/bin/bash cgi-bin/ php -P 1
pkill -f -x /usr/lib/