[FASTCGI] [PATCH] fix mod_fastcgi process manager to kill children without fail on Windows.

Takashi HOSHINO hoshino at labs.cybozu.co.jp
Tue Oct 20 21:44:02 EDT 2009


We found a bug in mod_fastcgi that PHP-5.3.0 as FastCGI server
often deadlocks with Apache-2.2.10 and mod_fastcgi-SNAP-0811090952
on Windows.

The reason is that TerminateProcess() is not called even though
fcgi_pm.c seems should do so when the child process is in blocking
state with named pipe, mutex lock, or so.

We created an one-line-patch to fix the problem as below.
The patch must work with the latest snapshot, though
we tested only in the above environment.

diff -Nrub mod_fastcgi-SNAP-0811090952/fcgi_pm.c
--- mod_fastcgi-SNAP-0811090952/fcgi_pm.c       2008-09-23
07:24:45.000000000 +0900
+++ mod_fastcgi-SNAP-0811090952.new/fcgi_pm.c   2009-10-19
17:07:02.000000000 +0900
@@ -176,7 +176,8 @@
         /* Send KILL to all processes */
         for (i = 0; i < numChildren; i++, proc++)
-            if (proc->state == FCGI_RUNNING_STATE)
+            if (proc->state == FCGI_RUNNING_STATE ||
+                proc->state == FCGI_VICTIM_STATE)
                 fcgi_kill(proc, SIGKILL);

Thank you,


HOSHINO Takashi <hoshino at labs.cybozu.co.jp>

More information about the FastCGI-developers mailing list