diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2003-08-21 13:45:06 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2003-08-21 13:45:06 +0000 |
commit | 83bcdec0a5728c723a484c6e3203d38f1d481ed1 (patch) | |
tree | 55cbdf9a73da3ed5be24f6bd84c1a1c389296d36 /usr.sbin/httpd | |
parent | 0e298b235bacc8cf8690097d3ac754f9005240b4 (diff) |
apache bug #21737 ( http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21737)
introduced with 1.3.28:
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.
fix by Ralf S. Engelschall:
That is, we don't have to check for the return value of ap_os_kill()
and especially not check for ESRCH, because we _HAVE_ to waitpid() for
it anyway (because it's our child and it either is already terminated
and is waiting as a zombie for our waitpid() or it is still running).
Under Unix it cannot be that a (non-detached in the sense of BSD's
daemon(3)) child of a process just does no longer exists as long as
the parent still exists and as long as the parent still has not done
waitpid() for the child. So ESRCH cannot happen in our situation and the
patch we currently use is fully sufficient. Both are at least portable
enough for Unix, of course...
Diffstat (limited to 'usr.sbin/httpd')
-rw-r--r-- | usr.sbin/httpd/src/main/alloc.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/usr.sbin/httpd/src/main/alloc.c b/usr.sbin/httpd/src/main/alloc.c index 942f1759452..1373258458b 100644 --- a/usr.sbin/httpd/src/main/alloc.c +++ b/usr.sbin/httpd/src/main/alloc.c @@ -3096,12 +3096,8 @@ static void free_proc_chain(struct process_chain *procs) if ((p->kill_how == kill_after_timeout) || (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; - } - else { - need_timeout = 1; - } + ap_os_kill(p->pid, SIGTERM); + need_timeout = 1; } else if (p->kill_how == kill_always) { kill(p->pid, SIGKILL); |