Commit 61438bbd authored by Ryan Bloom's avatar Ryan Bloom
Browse files

Fix graceful shutdown with the scoreboard changes. Basically, we want

to set the sb_type only after we zero out the scoreboard.  Before this,
we were segfaulting when we tried to free() a shared memory scoreboard.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88013 13f79535-47bb-0310-9956-ffa450edef68
parent 95fecc66
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -168,7 +168,6 @@ AP_DECLARE(void) ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e sb_type)
    if (ap_scoreboard_image == NULL) {
        if (sb_type == SB_SHARED) {
            setup_shared(p);
            ap_scoreboard_image->global.sb_type = SB_SHARED;
        }
        else {
            /* A simple malloc will suffice */
@@ -180,10 +179,10 @@ AP_DECLARE(void) ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e sb_type)
                perror(buf); /* o.k. since MM sets errno */
                exit(APEXIT_INIT);            
            }
            ap_scoreboard_image->global.sb_type = SB_NOT_SHARED;
        }
    }
    memset(ap_scoreboard_image, 0, SCOREBOARD_SIZE);
    ap_scoreboard_image->global.sb_type = sb_type;
    ap_scoreboard_image->global.running_generation = running_gen;
    ap_restart_time = apr_now();
    apr_register_cleanup(p, NULL, ap_cleanup_scoreboard, apr_null_cleanup);