httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Stoddard <>
Subject Graceful restart on Win32 Apache isn't.
Date Tue, 18 May 1999 18:56:59 GMT
The root problem is that sockets are not inherited across multiple
processes (maybe this can be fixed... Investigating).  A restart can
hang indefinitely if the server is busy.  A bug in the bug DB says a
restart commonly takes from 1 to 3 hours on a busy server. The reason is
that Apache waits until the TCP/IP stack's listen queue is completely
empty before killing the child and allowing a new child to take over. 

The alternative is for the child to close the sockets at the beginning
of a restart (which will dump connections on the listen queue), service
the connections already queued in the server then die. At least this way
the admin is guaranteed a quick restart.

Opinions on which is preferable? I tend to favor the quick restart at
the expense of loosing connections on the listen queue.

Other alternatives are available, at significant compexity...

1. Add a config directive that controls the restart behaviour
(Yeech....I wouldn't want to do this unless someomne sees a compelling
reason for it, which I don't).

2. Devise a way for the parent to:
a. recognize apache -k restart_graceful, or apache -k restart_ungraceful
b. signal the child to die in the appropriate way

I haven't given much thought on the best way to implement option 2.
Today, the parent signals the child accept thread via a simple exit
event (and there are no 'flavors' of exit). One thought... create a
child thread that waits on two events, a graceful restart event and an
ungraceful restart event. This thread receives the signal from the
parent and does the right thing (sets the exit event which in turn is
checked by the accept thread). Probably not too hard to implement. 

Thoughts? Is it worthwhile to pursue option 2? other?

Did a bit more testing before sending this note and uncovered more
interesting behaviour... A heavily loaded Apache on Win32 will not
shutdown if started as a service. (i.e., net stop apache, or apache -k
shutdown will hang until the listen queue is emptied). That's what I
expected to see.

Right now, I'm leaning heavily toward dumping all the connections in the
listen queue across a restart initiated from the command line and
graceful restart when MaxRequestsPerChild is hit.


Bill Stoddard

View raw message