From: Greg Ames Date: Fri, 26 Oct 2001 15:40:04 +0000 (+0000) Subject: prevent seg faults in mod_status trying to access vhost structures from X-Git-Tag: 2.0.27~23 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a3ffd0cfd0ac65e8cdb09ebe0c8b4f0b0162f3e8;p=apache prevent seg faults in mod_status trying to access vhost structures from the former generation, after a restart. It happens mostly when the MPM has threads. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91667 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/scoreboard.c b/server/scoreboard.c index e455d00209..afc018be6c 100644 --- a/server/scoreboard.c +++ b/server/scoreboard.c @@ -277,7 +277,7 @@ AP_DECLARE(int) find_child_by_pid(apr_proc_t *pid) AP_DECLARE(int) ap_update_child_status(int child_num, int thread_num, int status, request_rec *r) { - int old_status; + int old_status, i; worker_score *ws; process_score *ps; @@ -293,8 +293,12 @@ AP_DECLARE(int) ap_update_child_status(int child_num, int thread_num, int status if (status == SERVER_READY && old_status == SERVER_STARTING) { ws->thread_num = child_num * HARD_SERVER_LIMIT + thread_num; - ps->generation = ap_my_generation; - ws->vhostrec = NULL; + if (ps->generation != ap_my_generation) { + for (i = 0; i < HARD_THREAD_LIMIT; i++) { + ap_scoreboard_image->servers[child_num][i].vhostrec = NULL; + } + ps->generation = ap_my_generation; + } } if (ap_extended_status) {