httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cove...@apache.org
Subject svn commit: r739608 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS server/mpm/prefork/prefork.c
Date Sat, 31 Jan 2009 20:54:55 GMT
Author: covener
Date: Sat Jan 31 20:54:55 2009
New Revision: 739608

URL: http://svn.apache.org/viewvc?rev=739608&view=rev
Log:
Merge r732421, r732451 from trunk:

Release the accept mutex after receiving the shutdown signal
in single-process mode.  (That isn't a critical step, but
neatness counts.)

Submitted by: rpleum



prefork: Fix child process hang during graceful restart/stop in
configurations with multiple listening sockets.

PR: 42829
Submitted by: Joe Orton, with some tweaking and testing from me

Reviewed by: trawick, rpluem, jorton, pgollucci


Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/server/mpm/prefork/prefork.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=739608&r1=739607&r2=739608&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Sat Jan 31 20:54:55 2009
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.2.12
   
+ *) prefork: Fix child process hang during graceful restart/stop in
+    configurations with multiple listening sockets.  PR 42829.  [Joe Orton,
+    Jeff Trawick]
+
   *) mod_ssl: Add SSLRenegBufferSize directive to allow changing the
      size of the buffer used for the request-body where necessary
      during a per-dir renegotiation.  PR 39243.  [Joe Orton]

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=739608&r1=739607&r2=739608&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Sat Jan 31 20:54:55 2009
@@ -86,17 +86,6 @@
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
- * prefork: release mutex when exiting in single-process mode,
-   add timeout to pollset-poll to avoid hanging during graceful
-   stop/restart with multiple listening sockets
-   PR 42829
-   Trunk version of patche:
-     http://svn.apache.org/viewvc?rev=732421&view=rev
-     http://svn.apache.org/viewvc?rev=732451&view=rev
-   Backport version for 2.2.x of patch:
-      Trunk version of patch works
-   +1: trawick, rpluem, jorton, pgollucci
-
  * mod_proxy: Set the error time if we set a worker in error mode.
    Trunk version of patch:
       http://svn.apache.org/viewvc?rev=734703&view=rev

Modified: httpd/httpd/branches/2.2.x/server/mpm/prefork/prefork.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/server/mpm/prefork/prefork.c?rev=739608&r1=739607&r2=739608&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/server/mpm/prefork/prefork.c (original)
+++ httpd/httpd/branches/2.2.x/server/mpm/prefork/prefork.c Sat Jan 31 20:54:55 2009
@@ -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



Mime
View raw message