On Thu, Jan 31, 2002 at 06:40:01PM -0500, Dale Ghent wrote:
> From a users' standpoint, it would seem more like a bug in apache if
> s/he tries to shut apache down via apachectl, and then start it back up.
> 
> First, the shutdown will fail, because the ppid is no-longer existing
> (and thus producding the "unclean shutdown message), and when the
> attempt by the bewildered admin is made to start apache again, it fails
> because the childs are still bound to ports and whatnot.
> 
> Although I hold no voting power here, I'd say that the children are to
> die with the parent.

It might be useful to allow conceptual space for it to work either way.
Locally we've modified Apache 1.3.x for FreeBSD to add a "graceful
shutdown" signal at USR2.  Upon receiving this signal, the parent drops a
mark in the scoreboard, and does a shutdown() on the listen socket(s).
This indicates to the OS that it should stop accepting new connections on
the socket.  The existing requests continue to completion, and children
can even accept new requests off of the listen backlog
(ap_max_request_per_child is bumped up in the children in this case,
because the parent won't spin up new servers if the children die). Once
the backlog is empty, continued accept() calls will result in an error
(ECONNABORTED), and the child bails out.  Basically, this was to play nice
with our load balancer, you can shut down and start up servers with zero
requests lost in transit.

If that wasn't cool enough - once the parent calls shutdown() on the
listen sockets, FreeBSD lets us _immediately_ start a new server on the
same sockets.  So, rolling a new build is as simple as "shut the old one
down, start the new one up."

[BTW, I agree with the children killing themselves when the parent goes
away, perhaps configurable between "Kill yourself ASAP" versus "Kill
yourself when you come up for air between requests."  The notion of
killing everything which _looks_ like an Apache child scares me (what if
you're running multiple servers on a box?).]

Later,
scott hess
[EMAIL PROTECTED]

Reply via email to