httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dean gaudet <dgaudet-list-new-ht...@arctic.org>
Subject Re: Apache 1.3.x race condition causes gratuitous 3-second CGI delay
Date Wed, 28 Feb 2001 07:06:52 GMT
On Sat, 17 Feb 2001, Andrew Ho wrote:

> +    if (need_timeout) {
> +        old_disp = signal(SIGCHLD, null_sig_chld_handler);
> +        /* race condition here, we could get a SIGCHLD before we sleep, oh well */
> +        sleep(3);
> +        signal(SIGCHLD, old_disp);
> +    }

this terminates after one child exits, the child cleanup code is able to
handle an arbitrary number of children exiting... so it's not really a bug
fix.  you'd want to loop there through N children exiting.

i think if you dig through the archives there's some heated debate between
roy and me as to the validity of even killing the children at all (rather
than just having a SIGCHLD handler reaping them as they die on their own,
with maybe some global pid list for doing a cleanup on SIGHUP or SIGUSR1).
i can't even remember which side i was on and which roy was on, and maybe
we even agreed on this :)  today i kind of like the idea of doing the
cleanup asynchronously (1.3 has to be signal aware anyhow, so handling
SIGCHLD is not much work).

at the cost of another fork() you could have your CGI fork() and exit
before closing the pipe, then do your post cleanup in the child of your
cgi.

-dean


Mime
View raw message