httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Dessent <br...@dessent.net>
Subject Re: [users@httpd] Shutting down Apache very gracefully
Date Sat, 02 Aug 2003 01:24:28 GMT
Greg Webster wrote:
> 
> Hi all,
> 
> I know this has been asked before in a number of places (available on
> Google), but it seems to have never been resolved.
> 
> We've got a number of Apache webservers sitting behind a load-balancing
> controller. Occasionally we have to take one of the webservers down to
> make changes, and once in a while taking a webserver down causes broken
> connections for our users or our automated webserver-checkers.
> 
> What I want is a way to shut down Apache by killing idle child processes
> until all of them are dead and not accepting new requests. Then Apache
> can die without causing any broken connections. We've tried all the
> standard methods and the broken connections still occur.
> 
> Is there any 'best' way, or some way to do what I have listed above?

I have no idea if this would work but:

You might be able to exploit the SIGUSR1 (graceful restart) behavior. 
Normally, sending SIGUSR1 to the parent causes it to kill all idle
children, and signal to all active children to exit after servicing the
current request.  The parent then goes through a restart cycle,
including rereading the httpd.conf.

So, if you were to somehow temporarily force a syntax error in
httpd.conf, then send SIGUSR1, you would kill the parent and any idle
children, and they would not respawn because of the config error.  The
remaining children would exit after finishing the request they are
actively serving.

Note that you couldn't do this with 'apachectl graceful' since that runs
a config check first to make sure that the above scenario specifically
doesn't happen (since you usually want your server to keep running, not
die.)  You would have to do something like "kill -SIGUSR1 `cat
/var/run/httpd.pid`".

-- I have no idea if that would work or not and it sure is ugly, but if
there really is no other solution out there it might work.

Brian

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message