httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: Is a separate sigwait thread a good idea?
Date Thu, 18 Mar 1999 22:28:29 GMT
I don't see why a special signal thread is a problem... it shouldn't chew
up much of anything.  (If it does we can blame the library authors and
shame them into fixing things ;)  or something like that!)

Dean

On Thu, 18 Mar 1999, Manoj Kasichainula wrote:

> Right now, the child processes in apache-pthreads use a seperate
> thread running sigwait() to watch for signals to gracefully or
> ungracefully die. One thing we're trying to figure out is if there is
> a way to get rid of this thread. One possibility is switching to
> making one of the acceptor threads be the signal handling thread.
> 
> The problem with this change is that it requires setting up an actual
> signal handler, e.g. with sigaction. Pthreads calls can't be made from
> signal handlers, so we can't do things like watching for thread death,
> cleaning up pools (requires grabbing thread mutexes), or almost
> anything else useful from within a signal handler.
> 
> So, to switch to this solution, we need to essentially set a flag
> within the signal handler and hope that another thread reaches a point
> at which it will check the flag.
> 
> But, what happens if we're trying to kill a hung server? For example,
> we could have a child process with all the worker threads hung on a
> dead NFS server or something.  We will have race conditions in the
> acceptor threads that cause us not to be able to reach a flag check
> point, or if we switch to a select-accept model, there may be no
> acceptor threads at all. In this case, the parent process will note
> that the child is still alive and SIGKILL it.
> 
> So, we can either set aside one thread for waiting on signals in each
> child, or we could increase the possiblility somewhat that cleanups
> won't be executed when things are going very badly. Now, these
> cleanups may be important (closing long-lived database connections,
> killing Kerberos tickets, or whatever). What are your preferences
> here?
> 
> -- 
> Manoj Kasichainula - manojk@raleigh.ibm.com
> IBM Apache Development Team
> 


Mime
View raw message