You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Colm MacCarthaigh <co...@stdlib.net> on 2005/07/27 13:40:58 UTC
[PATCH] graceful restart bug as opportunity
configure.in makes a big deal about determining AP_SIG_GRACEFUL, which
defaults to SIGUSR1, but uses SIGWINCH on Linux 2.0. But then
mpm_common.c goes ahead and ignores this for actually sending the
signal, SIGUSR1 is hard-coded;
if (!strcmp(dash_k_arg, "graceful")) {
if (!running) {
printf("httpd not running, trying to start\n");
}
else {
*exit_status = send_signal(otherpid, SIGUSR1);
return 1;
}
}
I can only surmise that there just arn't very many linux 2.0 users who
try to do graceful restarts :-)
Anyway, an easy and obvious fix would be to patch that code to use
AP_SIG_GRACEFUL. However this sucks, so I've attached a totally more
insane patch to just use SIGUSR1 everywhere, and not support "graceful"
on Linux 2,0 (which doesn't work anyway, so it's not exactly a change).
I'm working on adding "graceful stop" (httpd -k drain) [1] and well
there's a shortage of genuinely usable signals. SIGUSR2 would be the
obvious choice, but;
/*
* SIGUSR2 is being removed from the mask for the convenience of
* Purify users (Solaris, HP-UX, SGI) since Purify uses SIGUSR2
*/
#ifdef SIGUSR2
sigdelset(sig_mask, SIGUSR2);
#endif
Which really leaves SIGWINCH as the only semi-reliable signal to use,
but that isn't free because of the stupid Linux 2.0 brokenness. So
rather than seeing this as a lunatic patch, I'm asking you to look into
your hearts and see this as an opportunity to free up a portable signal
so some nifty functionality can be added more easily.
Failing this, can anyone suggest a non-WINCH signal which is portable
and reliable? Or, how would people feel about ditching kill-style
signalling altogher and using some other IPC mechanism, for more
adaptable and futureproofing ?
[1] When you have a few hundred users downloading DVD ISO's over dialup,
not killing their downloads when upgrading the webserver would be a
real nice feature, and well I'm tired of JoS gloating about it in IIS;
http://joelonsoftware.com/items/2005/06/15.html ;)
--
Colm MacCárthaigh Public Key: colm+pgp@stdlib.net
Re: [PATCH] graceful restart bug as opportunity
Posted by Colm MacCarthaigh <co...@stdlib.net>.
On Wed, Jul 27, 2005 at 12:59:05PM +0100, Joe Orton wrote:
> SIGUSR1 is unavailable on Linux 2.0 iff linuxthreads is used, i.e. in a
> threaded MPM. It'd be better simply to refuse to allow use of threaded
> MPMs on such platforms (which nobody will notice) and allow graceful to
> use SIGUSR1 everywhere.
>
> +1 on the patch if that much is changed.
That's even slightly easier to implement. Patch attached, though it is
rather blunt and simply disables the threaded MPM's on Linux 2.0.
I can remember there being other threading libraries for 2.0, but I
don't have a 2.0 test system and I'm not sure if that can easily be
autoconfed either.
--
Colm MacCárthaigh Public Key: colm+pgp@stdlib.net
Re: [PATCH] graceful restart bug as opportunity
Posted by Joe Orton <jo...@redhat.com>.
On Wed, Jul 27, 2005 at 12:40:58PM +0100, Colm MacCarthaigh wrote:
> configure.in makes a big deal about determining AP_SIG_GRACEFUL, which
> defaults to SIGUSR1, but uses SIGWINCH on Linux 2.0. But then
> mpm_common.c goes ahead and ignores this for actually sending the
> signal, SIGUSR1 is hard-coded;
>
> if (!strcmp(dash_k_arg, "graceful")) {
> if (!running) {
> printf("httpd not running, trying to start\n");
> }
> else {
> *exit_status = send_signal(otherpid, SIGUSR1);
> return 1;
> }
> }
Heh :)
> I can only surmise that there just arn't very many linux 2.0 users who
> try to do graceful restarts :-)
>
> Anyway, an easy and obvious fix would be to patch that code to use
> AP_SIG_GRACEFUL. However this sucks, so I've attached a totally more
> insane patch to just use SIGUSR1 everywhere, and not support "graceful"
> on Linux 2,0 (which doesn't work anyway, so it's not exactly a change).
SIGUSR1 is unavailable on Linux 2.0 iff linuxthreads is used, i.e. in a
threaded MPM. It'd be better simply to refuse to allow use of threaded
MPMs on such platforms (which nobody will notice) and allow graceful to
use SIGUSR1 everywhere.
+1 on the patch if that much is changed.
joe
Re: [PATCH] graceful restart bug as opportunity
Posted by Colm MacCarthaigh <co...@stdlib.net>.
On Wed, Jul 27, 2005 at 09:01:53AM -0400, Bill Stoddard wrote:
> +1. Ken Coar and I have looked into the need for a 'graceful shutdown' and
> there may even be a patch posted to the dev list using an IPC (so long ago
> I don't recall the exact details). Freeing up SIGWINCH sounds like a good
> solution.
Thanks, I found this;
http://mail-archives.apache.org/mod_mbox/httpd-dev/200303.mbox/%3c3E84B1EC.3050007@Golux.Com%3e
And an ensuing discussion about the no-good-signal-free problem ;)
Looking at it there, the patch seems like it would work, except I think
the way the listeners are kept open by the children needs some changing,
so that the listening ports can be unbound immediately (like sshd does
on shutdown, for a good example).
--
Colm MacCárthaigh Public Key: colm+pgp@stdlib.net
Re: [PATCH] graceful restart bug as opportunity
Posted by Bill Stoddard <bi...@wstoddard.com>.
Colm MacCarthaigh wrote:
> configure.in makes a big deal about determining AP_SIG_GRACEFUL, which
> defaults to SIGUSR1, but uses SIGWINCH on Linux 2.0. But then
> mpm_common.c goes ahead and ignores this for actually sending the
> signal, SIGUSR1 is hard-coded;
>
> if (!strcmp(dash_k_arg, "graceful")) {
> if (!running) {
> printf("httpd not running, trying to start\n");
> }
> else {
> *exit_status = send_signal(otherpid, SIGUSR1);
> return 1;
> }
> }
>
> I can only surmise that there just arn't very many linux 2.0 users who
> try to do graceful restarts :-)
>
> Anyway, an easy and obvious fix would be to patch that code to use
> AP_SIG_GRACEFUL. However this sucks, so I've attached a totally more
> insane patch to just use SIGUSR1 everywhere, and not support "graceful"
> on Linux 2,0 (which doesn't work anyway, so it's not exactly a change).
>
> I'm working on adding "graceful stop" (httpd -k drain) [1] and well
> there's a shortage of genuinely usable signals. SIGUSR2 would be the
> obvious choice, but;
>
> /*
> * SIGUSR2 is being removed from the mask for the convenience of
> * Purify users (Solaris, HP-UX, SGI) since Purify uses SIGUSR2
> */
> #ifdef SIGUSR2
> sigdelset(sig_mask, SIGUSR2);
> #endif
>
> Which really leaves SIGWINCH as the only semi-reliable signal to use,
> but that isn't free because of the stupid Linux 2.0 brokenness. So
> rather than seeing this as a lunatic patch, I'm asking you to look into
> your hearts and see this as an opportunity to free up a portable signal
> so some nifty functionality can be added more easily.
+1. Ken Coar and I have looked into the need for a 'graceful shutdown' and there may even be a patch posted
to the dev list using an IPC (so long ago I don't recall the exact details). Freeing up SIGWINCH sounds like a
good solution.
Bill