]> granicus.if.org Git - apache/commitdiff
Merge r1668532, r1668535, r1668553 from trunk:
authorJim Jagielski <jim@apache.org>
Tue, 31 Mar 2015 12:54:40 +0000 (12:54 +0000)
committerJim Jagielski <jim@apache.org>
Tue, 31 Mar 2015 12:54:40 +0000 (12:54 +0000)
core: Initialize scoreboard's used optional functions on graceful restarts to
avoid a crash when relocation occurs.  PR 57177.

core: follow up to r1668532: CHANGES entry.

core: follow up to r1668532: always initialize optional_fn pointers in ap_create_scoreboard().
Submitted by: ylavic
Reviewed/backported by: jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1670325 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
server/core.c
server/scoreboard.c

diff --git a/CHANGES b/CHANGES
index e2adc759e5b25dc688508d2af3639663dfb98ca9..3f997bb956779e746546942a443d993d47b7e67c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -12,6 +12,9 @@ Changes with Apache 2.4.13
      calls r:wsupgrade() can cause a child process crash. 
      [Edward Lu <Chaosed0 gmail.com>]
 
+  *) core: Initialize scoreboard's used optional functions on graceful restarts
+     to avoid a crash when relocation occurs.  PR 57177.  [Yann Ylavic]
+
   *) mod_dav: Avoid a potential integer underflow in the lock timeout value sent
      back to a client. The answer to a LOCK request could be an extremly large
      integer if the time needed to lock the resource was longer that the
diff --git a/STATUS b/STATUS
index 02369d6005ad650e651c96caf8ca7c17344b8924..8476939bd11cb83fa105845bfcf1355cffd0d2b0 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -106,23 +106,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  *) mod_proxy_connect/wstunnel: If both client and backend sides get readable
-     at the same time, don't lose errors occuring while forwarding on the first
-     side when none occurs next on the other side, and abort.
-     trunk patch: http://svn.apache.org/r1657636
-                  http://svn.apache.org/r1657638
-                  http://svn.apache.org/r1669130
-     2.4.x patch: http://people.apache.org/~ylavic/httpd-2.4.x-mod_proxy-transfer-v3.patch
-     +1: ylavic, covener, jim
-
-  *) core: Initialize scoreboard's used optional functions on graceful restarts to
-     avoid a crash when relocation occurs.  PR 57177.
-     trunk patch: http://svn.apache.org/r1668532
-                  http://svn.apache.org/r1668535 (CHANGES entry)
-                  http://svn.apache.org/r1668553
-     2.4.x patch: trunk works (modulo CHANGES)
-     +1: ylavic, covener, jim
-
   *) core: If explicitly configured, use the KeepaliveTimeout value of the
      virtual host which handled the latest request on the connection, or by
      default the one of the first virtual host bound to the same IP:port.
index 749cf5c1661a32f0bf66aaf275393b6b5d0c4e96..1ef958098c3ff4cc3371ba66c0a7764fe4a6aa7f 100644 (file)
@@ -4760,6 +4760,11 @@ static void core_child_init(apr_pool_t *pchild, server_rec *s)
     apr_random_after_fork(&proc);
 }
 
+static void core_optional_fn_retrieve(void)
+{
+    ap_init_scoreboard(NULL);
+}
+
 AP_CORE_DECLARE(void) ap_random_parent_after_fork(void)
 {
     /*
@@ -4939,6 +4944,8 @@ static void register_hooks(apr_pool_t *p)
                                   APR_HOOK_REALLY_LAST);
     ap_hook_dirwalk_stat(core_dirwalk_stat, NULL, NULL, APR_HOOK_REALLY_LAST);
     ap_hook_open_htaccess(ap_open_htaccess, NULL, NULL, APR_HOOK_REALLY_LAST);
+    ap_hook_optional_fn_retrieve(core_optional_fn_retrieve, NULL, NULL,
+                                 APR_HOOK_MIDDLE);
     
     /* register the core's insert_filter hook and register core-provided
      * filters
index fa04b91ff41626b931ed9de98b9e6cc71126c05d..9e16a2ae5e557d7bf36640fa5f98d4c761f78a61 100644 (file)
@@ -138,8 +138,6 @@ AP_DECLARE(int) ap_calc_scoreboard_size(void)
     scoreboard_size += sizeof(process_score) * server_limit;
     scoreboard_size += sizeof(worker_score) * server_limit * thread_limit;
 
-    pfn_ap_logio_get_last_bytes = APR_RETRIEVE_OPTIONAL_FN(ap_logio_get_last_bytes);
-
     return scoreboard_size;
 }
 
@@ -148,6 +146,11 @@ AP_DECLARE(void) ap_init_scoreboard(void *shared_score)
     char *more_storage;
     int i;
 
+    pfn_ap_logio_get_last_bytes = APR_RETRIEVE_OPTIONAL_FN(ap_logio_get_last_bytes);
+    if (!shared_score) {
+        return;
+    }
+    
     ap_calc_scoreboard_size();
     ap_scoreboard_image =
         ap_calloc(1, sizeof(scoreboard) + server_limit * sizeof(worker_score *));
@@ -299,8 +302,6 @@ int ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e sb_type)
     apr_status_t rv;
 #endif
 
-    pfn_ap_logio_get_last_bytes = APR_RETRIEVE_OPTIONAL_FN(ap_logio_get_last_bytes);
-
     if (ap_scoreboard_image) {
         ap_scoreboard_image->global->restart_time = apr_time_now();
         memset(ap_scoreboard_image->parent, 0,
@@ -309,6 +310,7 @@ int ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e sb_type)
             memset(ap_scoreboard_image->servers[i], 0,
                    sizeof(worker_score) * thread_limit);
         }
+        ap_init_scoreboard(NULL);
         return OK;
     }