From c69e8953da7ba848b3cc4e8270123ac195539837 Mon Sep 17 00:00:00 2001 From: "William A. Rowe Jr" Date: Wed, 20 Mar 2002 06:04:51 +0000 Subject: [PATCH] The source of some ills ... there is no reason to keep going if the scoreboard exists. I suspect this should be a general cleanup as well [at the end of ap_create_scoreboard.] But calling ap_run_pre_mpm with the process->pool should take care of a clobbered scoreboard shm on graceful restart. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94040 13f79535-47bb-0310-9956-ffa450edef68 --- server/scoreboard.c | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/server/scoreboard.c b/server/scoreboard.c index b1f5b69264..8e866f6975 100644 --- a/server/scoreboard.c +++ b/server/scoreboard.c @@ -295,38 +295,40 @@ int ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e sb_type) if (ap_scoreboard_image) { running_gen = ap_scoreboard_image->global->running_generation; + return OK; } - if (ap_scoreboard_image == NULL) { - ap_calc_scoreboard_size(); + ap_calc_scoreboard_size(); #if APR_HAS_SHARED_MEMORY - if (sb_type == SB_SHARED) { - void *sb_shared; - rv = open_scoreboard(p); - if (rv || !(sb_shared = apr_shm_baseaddr_get(ap_scoreboard_shm))) { - return HTTP_INTERNAL_SERVER_ERROR; - } - memset(sb_shared, 0, scoreboard_size); - ap_init_scoreboard(sb_shared); + if (sb_type == SB_SHARED) { + void *sb_shared; + rv = open_scoreboard(p); + if (rv || !(sb_shared = apr_shm_baseaddr_get(ap_scoreboard_shm))) { + return HTTP_INTERNAL_SERVER_ERROR; } - else + memset(sb_shared, 0, scoreboard_size); + ap_init_scoreboard(sb_shared); + } + else #endif - { - /* A simple malloc will suffice */ - void *sb_mem = calloc(1, scoreboard_size); - if (sb_mem == NULL) { - ap_log_error(APLOG_MARK, APLOG_CRIT | APLOG_NOERRNO, 0, NULL, - "(%d)%s: cannot allocate scoreboard", - errno, strerror(errno)); - return HTTP_INTERNAL_SERVER_ERROR; - } - ap_init_scoreboard(sb_mem); + { + /* A simple malloc will suffice */ + void *sb_mem = calloc(1, scoreboard_size); + if (sb_mem == NULL) { + ap_log_error(APLOG_MARK, APLOG_CRIT | APLOG_NOERRNO, 0, NULL, + "(%d)%s: cannot allocate scoreboard", + errno, strerror(errno)); + return HTTP_INTERNAL_SERVER_ERROR; } + ap_init_scoreboard(sb_mem); } + ap_scoreboard_image->global->sb_type = sb_type; ap_scoreboard_image->global->running_generation = running_gen; ap_scoreboard_image->global->restart_time = apr_time_now(); + apr_pool_cleanup_register(p, NULL, ap_cleanup_scoreboard, apr_pool_cleanup_null); + return OK; } -- 2.40.0