SOURCES: apache-prefork-graceful-fix.patch (NEW) - from upstream: fix child...

hawk hawk at pld-linux.org
Thu Feb 12 17:15:21 CET 2009


Author: hawk                         Date: Thu Feb 12 16:15:21 2009 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- from upstream: fix child process hang during graceful restart/stop in
  configurations with multiple listening sockets

---- Files affected:
SOURCES:
   apache-prefork-graceful-fix.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/apache-prefork-graceful-fix.patch
diff -u /dev/null SOURCES/apache-prefork-graceful-fix.patch:1.1
--- /dev/null	Thu Feb 12 17:15:22 2009
+++ SOURCES/apache-prefork-graceful-fix.patch	Thu Feb 12 17:15:15 2009
@@ -0,0 +1,42 @@
+--- server/mpm/prefork/prefork.c	2009/01/31 20:53:11	739607
++++ server/mpm/prefork/prefork.c	2009/01/31 20:54:55	739608
+@@ -577,19 +577,27 @@
+                 apr_int32_t numdesc;
+                 const apr_pollfd_t *pdesc;
+ 
+-                /* timeout == -1 == wait forever */
+-                status = apr_pollset_poll(pollset, -1, &numdesc, &pdesc);
++                /* check for termination first so we don't sleep for a while in
++                 * poll if already signalled
++                 */
++                if (one_process && shutdown_pending) {
++                    SAFE_ACCEPT(accept_mutex_off());
++                    return;
++                }
++                else if (die_now) {
++                    /* In graceful stop/restart; drop the mutex
++                     * and terminate the child. */
++                    SAFE_ACCEPT(accept_mutex_off());
++                    clean_child_exit(0);
++                }
++                /* timeout == 10 seconds to avoid a hang at graceful restart/stop
++                 * caused by the closing of sockets by the signal handler
++                 */
++                status = apr_pollset_poll(pollset, apr_time_from_sec(10), 
++                                          &numdesc, &pdesc);
+                 if (status != APR_SUCCESS) {
+-                    if (APR_STATUS_IS_EINTR(status)) {
+-                        if (one_process && shutdown_pending) {
+-                            return;
+-                        }
+-                        else if (die_now) {
+-                            /* In graceful stop/restart; drop the mutex
+-                             * and terminate the child. */
+-                            SAFE_ACCEPT(accept_mutex_off());
+-                            clean_child_exit(0);
+-                        }
++                    if (APR_STATUS_IS_TIMEUP(status) ||
++                        APR_STATUS_IS_EINTR(status)) {
+                         continue;
+                     }
+                     /* Single Unix documents select as returning errnos
================================================================


More information about the pld-cvs-commit mailing list