Commit 5bdb5518 authored by Bill Stoddard's avatar Bill Stoddard
Browse files

Win32: Revamp NT shutdown code. I think this shutdown code is pretty close

to production ready. Introduce a two-phase shutdown. First phase is
shutdown_pending which prevents new contexts from being queued to the
AcceptEx completion port.  The server runs for a period (~1 second)
in this state to enable threads to drain the completion port of active
connections by handling the connections. This works very well on a busy
server as the contexts are consumed quickly and completely (leaving non
to cancel in the next phase).

The next phase is the workers_may exit phase, which prevents threads
from blocking on the completion port (especially important to prevent
threads unblocking off of keep-alive connections from calling
GetQueuedCompletionStatus).  One we enter this phase, all threads blocked on the
port (we track the number carefully) are unblocked and allowed to exit.
Then we cancel any pending i/o completion contexts on the listeners (those which
were not consumed naturally in the shutdown phase). Then we reap the ABORTED
completion packets off the port. (Possible to reap a few good "accepted"
connections here also. Oh well...). Once we are done reaping completion packets,
we release the start mutex which allows the new child (in a restart) to
begin accepting connections.

It is really REALLY important to not let multiple processes call
GetQueuedCompletionStatus at the same time.  Results are unpredictable.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85907 13f79535-47bb-0310-9956-ffa450edef68
parent c10e5bcd
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment