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