Since APR-1.7 (r1854995), SIGUSR2 is removed from the list of
uncatchable synchronous signals so it could be used instead of
SIGWINCH for graceful stop in httpd.

The problem with SIGWINCH is when httpd is run from a pseudo-terminal
(not detached), it raises for any window resizing (which is not ideal,
notably when debugging).

The patch would look like the attached one. Not so bad idea?


Cheers;
Yann.
Index: include/mpm_common.h
===================================================================
--- include/mpm_common.h	(revision 1889960)
+++ include/mpm_common.h	(working copy)
@@ -45,6 +45,7 @@
 #include <netinet/tcp.h>    /* for TCP_NODELAY */
 #endif
 
+#include "apr_version.h"
 #include "apr_proc_mutex.h"
 
 #ifdef __cplusplus
@@ -73,13 +74,25 @@ extern "C" {
 #define AP_SIG_GRACEFUL_STRING "SIGUSR1"
 
 /* Signal used to gracefully stop */
+#if APR_VERSION_AT_LEAST(1,7,0)
+#define AP_SIG_GRACEFUL_STOP SIGUSR2
+#else
 #define AP_SIG_GRACEFUL_STOP SIGWINCH
+#endif
 
 /* Signal used to gracefully stop (without SIG prefix) */
+#if APR_VERSION_AT_LEAST(1,7,0)
+#define AP_SIG_GRACEFUL_STOP_SHORT USR2
+#else
 #define AP_SIG_GRACEFUL_STOP_SHORT WINCH
+#endif
 
 /* Signal used to gracefully stop (as a quoted string) */
+#if APR_VERSION_AT_LEAST(1,7,0)
+#define AP_SIG_GRACEFUL_STOP_STRING "SIGUSR2"
+#else
 #define AP_SIG_GRACEFUL_STOP_STRING "SIGWINCH"
+#endif
 
 /**
  * Callback function used for ap_reclaim_child_processes() and
Index: server/mpm/motorz/motorz.c
===================================================================
--- server/mpm/motorz/motorz.c	(revision 1889960)
+++ server/mpm/motorz/motorz.c	(working copy)
@@ -855,7 +855,7 @@ static void child_main(motorz_core_t *mz, int chil
 
         status = apr_pollset_add(mz->pollset, pfd);
         if (status != APR_SUCCESS) {
-            /* If the child processed a SIGWINCH before setting up the
+            /* If the child processed a signal before setting up the
              * pollset, this error path is expected and harmless,
              * since the listener fd was already closed; so don't
              * pollute the logs in that case. */
Index: server/mpm/netware/mpm_netware.c
===================================================================
--- server/mpm/netware/mpm_netware.c	(revision 1889960)
+++ server/mpm/netware/mpm_netware.c	(working copy)
@@ -121,7 +121,7 @@ static int mpm_state = AP_MPMQ_STARTING;
 
 /*
  * The max child slot ever assigned, preserved across restarts.  Necessary
- * to deal with MaxRequestWorkers changes across SIGWINCH restarts.  We use this
+ * to deal with MaxRequestWorkers changes across graceful restarts.  We use this
  * value to optimize routines that have to scan the entire scoreboard.
  */
 static int ap_max_workers_limit = -1;
@@ -285,7 +285,7 @@ static void sig_term(int sig)
     DBPRINT0 ("goodbye\n");
 }
 
-/* restart() is the signal handler for SIGHUP and SIGWINCH
+/* restart() is the signal handler for SIGHUP and AP_SIG_GRACEFUL_STOP
  * in the parent process, unless running in ONE_PROCESS mode
  */
 static void restart(void)
Index: server/mpm/prefork/prefork.c
===================================================================
--- server/mpm/prefork/prefork.c	(revision 1889960)
+++ server/mpm/prefork/prefork.c	(working copy)
@@ -472,7 +472,7 @@ static void child_main(int child_num_arg, int chil
 
         status = apr_pollset_add(pollset, pfd);
         if (status != APR_SUCCESS) {
-            /* If the child processed a SIGWINCH before setting up the
+            /* If the child processed a signal before setting up the
              * pollset, this error path is expected and harmless,
              * since the listener fd was already closed; so don't
              * pollute the logs in that case. */

Reply via email to