Return-Path: Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 8401 invoked by uid 500); 21 Jul 2003 02:26:20 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 8386 invoked from network); 21 Jul 2003 02:26:20 -0000 Date: Sun, 20 Jul 2003 22:26:27 -0400 (EDT) From: Cliff Woolley X-X-Sender: jcw5q@cobra.cs.Virginia.EDU To: dev@httpd.apache.org Subject: suexec+CGI = zombies in 1.3.28 Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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;