httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cliff Woolley <jwool...@virginia.edu>
Subject suexec+CGI = zombies in 1.3.28
Date Mon, 21 Jul 2003 02:26:27 GMT

For those not watching the bugzilla notices, I direct your attention to
bug 21737:

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21737

Apparently there has been a regression in 1.3.28 from 1.3.27 whereby
CGI scripts are getting left around as zombies when suexec is in use,
apparently because of a change in src/main/alloc.c that altered the
behavior when sending SIGTERM to a child process.  With suexec, the
SIGTERM at line 2862 will fail not because the subprocess is dead already
but because the httpd uid has no permission to term the cgi process, which
is running as some other user.

A suggested patch posted by one of the users is below.  It doesn't look
portable to me, but the idea seems sound.

Thoughts?
Cliff



--- apache_1.3.28/src/main/alloc.c.orig	Sun Jul 20 14:30:30 2003
+++ apache_1.3.28/src/main/alloc.c	Sun Jul 20 14:33:50 2003
@@ -2860,7 +2860,14 @@
 	    || (p->kill_how == kill_only_once)) {
 	    /* Subprocess may be dead already.  Only need the timeout if not. */
 	    if (ap_os_kill(p->pid, SIGTERM) == -1) {
-                p->kill_how = kill_never;
+		/* If the kill failed, find out why.  If the process does
+		   not exist then we do not need to kill it.  */
+		if (errno == ESRCH) {
+	                p->kill_how = kill_never;
+		}
+		else {
+			need_timeout = 1;
+		}
             }
             else {
 		need_timeout = 1;


Mime
View raw message