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

Takashi HOSHINO <[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
Hello,

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.new/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

---
HOSHINO Takashi <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.