I believe that the problem is platform specific.  The reason that loop
was added, was to allow for graceless shutdown on linux.  On non-linux
platforms, killing the main thread kills the whole process, but on linux
this doesn't work.  The point of closing the sockets was to force the
worker threads to finish ASAP so that the process could die.

Ryan

> From: Brian Pane [mailto:[EMAIL PROTECTED]]
> 
> During the worker MPM non-graceful shutdown, the signal_threads()
> function attempts to close all open sockets.
> 
> I have two major objections to this:
> 
> 1) It's not necessarily safe to close a socket that another thread
>    is using.  Note that apr_socket_close() calls the pool cleanup
>    on the pool from which the socket was allocated--bad news if
>    one of the active worker threads happens to be, say, registering
>    a new cleanup in the same pool at the same time.
> 
> 2) It appears to be contributing to the fact that non-graceful
>    shutdown doesn't work.  Without the socket shutdown loop,
>    the child processes shut down promptly.
> 
> As I understand it, the motivation for closing the sockets during
> shutdown was to try to fix a race condition in which an active
> worker thread might be trying to write to a socket at the same
> time that the underlying pool was being destroyed (due to the
> recursive destruction of APR's global_pool during apr_terminate()).
> 
> If so, I think the right solution is to add a way to create
> parentless pools that aren't implicitly added as children to
> the global pool, so that a worker thread's pool won't disappear
> before that thread does.  Is there any specific reason why we're
> not doing this already?
> 
> Thanks,
> --Brian
> 


Reply via email to