From 2891153f6b4a6314efaca94bd7d8bdccb0c96daf Mon Sep 17 00:00:00 2001 From: Yann Ylavic Date: Thu, 16 Jun 2022 13:54:39 +0000 Subject: mpm_prefork: Do not access the POD in ONE_PROCESS mode. There is no POD created in ONE_PROCESS mode, so avoid crashing in child_main() and clean_child_exit(). While at it, remove a dead code path in prefork_run() which is never reached since the one_process path already returns/exits above. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1901974 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/prefork/prefork.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'server') diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index e26ee4f7ef..d9837725c9 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -241,9 +241,12 @@ static void clean_child_exit_ex(int code, int from_signal) if (one_process) { prefork_note_child_killed(/* slot */ 0, 0, 0); + /* no POD to close in one_process mode */ + } + else { + ap_mpm_pod_close(my_bucket->pod); } - ap_mpm_pod_close(my_bucket->pod); chdir_for_gprof(); exit(code); } @@ -693,7 +696,8 @@ static void child_main(int child_num_arg, int child_bucket) * while we were processing the connection or we are the lucky * idle server process that gets to die. */ - if (ap_mpm_pod_check(my_bucket->pod) == APR_SUCCESS) { /* selected as idle? */ + if (!one_process /* no POD in one_process mode */ + && ap_mpm_pod_check(my_bucket->pod) == APR_SUCCESS) { /* selected as idle? */ die_now = 1; } else if (retained->mpm->my_generation != @@ -1274,12 +1278,6 @@ static int prefork_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) return DONE; } - /* we've been told to restart */ - if (one_process) { - /* not worth thinking about */ - return DONE; - } - if (!retained->mpm->is_ungraceful) { ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf, APLOGNO(00171) "Graceful restart requested, doing restart"); -- cgit v1.2.1