Commit 99ec1c2a authored by Justin Erenkrantz's avatar Justin Erenkrantz
Browse files

Switch back to SIGUSR1 for graceful restarts on all platforms that

support it.  This defines a symbol called AP_SIG_GRACEFUL in
ap_config_auto.h which will have the appropriate signal value.  All
direct references to SIGWINCH have been replaced with AP_SIG_GRACEFUL.

On Linux 2.0, use SIGWINCH instead since SIGUSR1 is used by glibc
2.0's user-space threading library to control threads.  All later
versions of Linux/glibc don't have this problem.  (Not to mention the
security holes in older Linux versions which make it unsuitable for
use as a web server.)  If your platform doesn't have SIGUSR1, use the
appropriate mojo in configure to define what your graceful restart
signal should be.

In theory, a configure switch could be added to allow the admin to
specify the appropriate signal that should be used.  This is left
as an exercise to the reader for now.

The docs need to be updated.  Since the signal is now configurable,
just saying SIGUSR1 for graceful restart isn't completely true.  Also,
the apachectl functionality needs to be moved into httpd - this is
what Win32 does and it makes us consistent across platforms.

Roy issued a veto against use of SIGWINCH by default, so this should
resolve that veto.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91076 13f79535-47bb-0310-9956-ffa450edef68
parent d554b00f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
Changes with Apache 2.0.26-dev

  *) Switch back to SIGUSR1 for graceful restarts on all platforms that
     support it.  [Justin Erenkrantz]

  *) Cleanup the worker MPM.  We no longer re-use transaction
     pools.  This incurs less overhead than shuffling the pools
     around so that they can be re-used.  Remove one of the
+11 −1
Original line number Diff line number Diff line
@@ -142,6 +142,8 @@ esac
APACHE_SUBST(SHLTCFLAGS)
APACHE_SUBST(LTCFLAGS)

AP_SIG_GRACEFUL=SIGUSR1

case $host in
  *-apple-aux3*)
      APR_SETVAR(APACHE_MPM, [prefork])
@@ -157,7 +159,11 @@ case $host in
      ;;
  *-linux-*)
      case `uname -r` in
        2.[[2-9]]* ) APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1])
        2.0* ) 
            AP_SIG_GRACEFUL=SIGWINCH
            ;;
        2.[[2-9]]* ) 
            APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1])
            ;;
        * )
            ;;
@@ -347,6 +353,10 @@ if test "$SINGLE_LISTEN_UNSERIALIZED_ACCEPT" = "1"; then
              [This platform doesn't suffer from the thundering herd problem])
fi

AC_DEFINE_UNQUOTED(AP_SIG_GRACEFUL, $AP_SIG_GRACEFUL, [Signal used to gracefully restart])
AC_DEFINE_UNQUOTED(AP_SIG_GRACEFUL_STRING, "$AP_SIG_GRACEFUL", [Signal used to gracefully restart (as a quoted string)])
AC_SUBST(AP_SIG_GRACEFUL)

dnl check for endianness
if test "$cross_compiling" = "no"; then
  AC_C_BIGENDIAN
+3 −3
Original line number Diff line number Diff line
@@ -238,10 +238,10 @@ static void cgid_maint(int reason, void *data, apr_wait_t status)
        case APR_OC_REASON_LOST:
            /* it would be better to restart just the cgid child
             * process but for now we'll gracefully restart the entire 
             * server by sending SIGWINCH to ourself, the httpd parent
             * process
             * server by sending AP_SIG_GRACEFUL to ourself, the httpd 
             * parent process
             */
            kill(getpid(), SIGWINCH);
            kill(getpid(), AP_SIG_GRACEFUL);
            break;
        case APR_OC_REASON_RESTART:
            apr_proc_other_child_unregister(data);
+5 −5
Original line number Diff line number Diff line
@@ -59,8 +59,8 @@
/* 
 * This module is used to load Apache modules at runtime. This means that the
 * server functionality can be extended without recompiling and even without
 * taking the server down at all. Only a HUP or WINCH signal needs to be send
 * to the server to reload the dynamically loaded modules.
 * taking the server down at all. Only a HUP or AP_SIG_GRACEFUL signal 
 * needs to be sent to the server to reload the dynamically loaded modules.
 *
 * To use, you'll first need to build your module as a shared library, then
 * update your configuration (httpd.conf) to get the Apache core to load the
@@ -98,9 +98,9 @@
 * directive to get these log messages).
 *
 * If you edit the LoadModule directives while the server is live you can get
 * Apache to re-load the modules by sending it a HUP or WINCH signal as normal.
 * You can use this to dynamically change the capability of your server
 * without bringing it down.
 * Apache to re-load the modules by sending it a HUP or AP_SIG_GRACEFUL 
 * signal as normal.  You can use this to dynamically change the capability 
 * of your server without bringing it down.
 *
 * Because currently there is only limited builtin support in the Configure
 * script for creating the shared library files (`.so'), please consult your
+1 −1
Original line number Diff line number Diff line
@@ -527,7 +527,7 @@ AP_DECLARE(void) ap_log_pid(apr_pool_t *p, const char *fname)
    mypid = getpid();
    if (mypid != saved_pid 
         && apr_stat(&finfo, fname, APR_FINFO_MTIME, p) == APR_SUCCESS) {
      /* WINCH and HUP call this on each restart.
      /* AP_SIG_GRACEFUL and HUP call this on each restart.
       * Only warn on first time through for this pid.
       *
       * XXX: Could just write first time through too, although
Loading