]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mpm_prefork: Do not access the POD in ONE_PROCESS mode.
authorYann Ylavic <ylavic@apache.org>
Thu, 16 Jun 2022 13:54:39 +0000 (13:54 +0000)
committerYann Ylavic <ylavic@apache.org>
Thu, 16 Jun 2022 13:54:39 +0000 (13:54 +0000)
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

index e26ee4f7efe127291edc32b75d70a548d7844f7a..d9837725c9e833a41e2f3272d0bf7da1d1516193 100644 (file)
@@ -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");