]> granicus.if.org Git - apache/commitdiff
Fix a race condition found by David Colasurdo <davecola@us.ibm.com>. We
authorManoj Kasichainula <manoj@apache.org>
Thu, 11 Nov 1999 22:57:19 +0000 (22:57 +0000)
committerManoj Kasichainula <manoj@apache.org>
Thu, 11 Nov 1999 22:57:19 +0000 (22:57 +0000)
should make sure that the parent notes the creation of a child process
in the scoreboard so that perform_idle_server_maintanence doesn't get
the chance to claim that slot.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84116 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/mpmt_pthread/mpmt_pthread.c

index dddb9ca8544c7456daff72b5bc22a98b884faf55..383724dc51a9abdeac9f1d679a9351f593c12382 100644 (file)
@@ -1028,8 +1028,18 @@ static int make_child(server_rec *s, int slot, time_t now) /* ZZZ */
        child_main(slot);
     }
 
+    /* Tag this slot as occupied so that perform_idle_server_maintenance
+     * doesn't try to steal it */
+    (void) ap_update_child_status(slot, 0, SERVER_STARTING, (request_rec *) NULL);
+
     if ((pid = fork()) == -1) {
         ap_log_error(APLOG_MARK, APLOG_ERR, errno, s, "fork: Unable to fork new process");
+
+        /* fork didn't succeed. Fix the scoreboard or else
+         * it will say SERVER_STARTING forever and ever
+         */
+        (void) ap_update_child_status(slot, 0, SERVER_DEAD, (request_rec *) NULL);
+
        /* In case system resources are maxxed out, we don't want
           Apache running away with the CPU trying to fork over and
           over and over again. */