httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bojan Smojver <bo...@rexursive.com>
Subject Re: worker MPM: close_worker_sockets race?
Date Fri, 30 Oct 2009 02:07:19 GMT
On Fri, 2009-10-23 at 10:12 +1100, Bojan Smojver wrote:
> Slower, but safer attached (not even compiled, so could be utterly
> bogus).

BTW, this approach still isn't safe. The socket can disappear (i.e. be
closed) between the test and the closing (or shutdown()). Worse, with
shutdown(), we could attempt to shut down the wrong FD, if we have fast
succession of close()/open() in various threads.

I think the correct approach would be to make sure that we actually
suspend worker threads before we do this. In other words, we send a
signal to each worker thread and their signal handler calls
sigsuspend(), thus waiting to be resumed. We also set thread specific
variables, notifying the listener thread about workers that have been
suspended.

Once the listener thread knows this (i.e. that all workers are
suspended), it shuts the sockets down and resumes the worker threads by
sending them a signal.

Workable?

-- 
Bojan


Mime
View raw message