httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yla...@apache.org
Subject svn commit: r1668532 - in /httpd/httpd/trunk/server: core.c scoreboard.c
Date Mon, 23 Mar 2015 08:07:19 GMT
Author: ylavic
Date: Mon Mar 23 08:07:18 2015
New Revision: 1668532

URL: http://svn.apache.org/r1668532
Log:
core: Initialize scoreboard's used optional functions on graceful restarts to
avoid a crash when relocation occurs.  PR 57177.

Modified:
    httpd/httpd/trunk/server/core.c
    httpd/httpd/trunk/server/scoreboard.c

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=1668532&r1=1668531&r2=1668532&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Mon Mar 23 08:07:18 2015
@@ -5063,6 +5063,11 @@ static void core_child_init(apr_pool_t *
     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)
 {
     /*
@@ -5242,6 +5247,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

Modified: httpd/httpd/trunk/server/scoreboard.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/scoreboard.c?rev=1668532&r1=1668531&r2=1668532&view=diff
==============================================================================
--- httpd/httpd/trunk/server/scoreboard.c (original)
+++ httpd/httpd/trunk/server/scoreboard.c Mon Mar 23 08:07:18 2015
@@ -138,8 +138,6 @@ AP_DECLARE(int) ap_calc_scoreboard_size(
     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
     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,
     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,



Mime
View raw message