]> granicus.if.org Git - apache/commitdiff
Here's the patch that really sucks. old_listeners points to an array
authorWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 20 Mar 2002 07:03:07 +0000 (07:03 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 20 Mar 2002 07:03:07 +0000 (07:03 +0000)
  of apr_socket objects already destroyed by their cleanups, and in any
  case they now live in invalid memory.  Extend their lifetimes.

  This implies that the process pool grows on every restart for no good
  reason.  One possible solution is to let the old pconf survive until
  the new pconf is alive.  Another is to create the listeners in a subpool
  of process->pool, destroyed after the old_listeners are closed.

  Either which way, a better solution exists, but this closes the immediate
  bug.  [How haven't we been segfaulting in unix on restarts before this
  patch, gurus?]

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94048 13f79535-47bb-0310-9956-ffa450edef68

server/listen.c

index a5b4b0c14ebffbfe425915f79804e7243597b3c1..8e0a539dd4ee7ec0e1bb85bab03b2e391a254b21 100644 (file)
@@ -307,9 +307,8 @@ static void alloc_listener(process_rec *process, char *addr, apr_port_t port)
     ap_listeners = new;
 }
 
-static int ap_listen_open(process_rec *process, apr_port_t port)
+static int ap_listen_open(apr_pool_t *pool, apr_port_t port)
 {
-    apr_pool_t *pconf = process->pconf;
     ap_listen_rec *lr;
     ap_listen_rec *next;
     int num_open;
@@ -324,7 +323,7 @@ static int ap_listen_open(process_rec *process, apr_port_t port)
             ++num_open;
         }
         else {
-            if (make_sock(pconf, lr) == APR_SUCCESS) {
+            if (make_sock(pool, lr) == APR_SUCCESS) {
                 ++num_open;
                 lr->active = 1;
             }
@@ -343,7 +342,7 @@ static int ap_listen_open(process_rec *process, apr_port_t port)
     }
     old_listeners = NULL;
 
-    apr_pool_cleanup_register(pconf, NULL, apr_pool_cleanup_null,
+    apr_pool_cleanup_register(pool, NULL, apr_pool_cleanup_null,
                               close_listeners_on_exec);
 
     return num_open ? 0 : -1;
@@ -354,7 +353,7 @@ int ap_setup_listeners(server_rec *s)
     ap_listen_rec *lr;
     int num_listeners = 0;
 
-    if (ap_listen_open(s->process, s->port)) {
+    if (ap_listen_open(s->process->pool, s->port)) {
        return 0;
     }