]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
When we detect a child exiting with APEXIT_CHILDFATAL in process_child_status(),
authorMartin Kraemer <martin@apache.org>
Mon, 21 Oct 2002 13:41:57 +0000 (13:41 +0000)
committerMartin Kraemer <martin@apache.org>
Mon, 21 Oct 2002 13:41:57 +0000 (13:41 +0000)
we simply exit(). Remove the pid file too, because it makes no sense after
the parent has terminated.
I assume that a better strategy here would be to kill(getpid(), SIGTERM) to
enforce a regular shutdown sequence, killing the other child processes too.
At the moment, they might be left running and blocking the server socket.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@97275 13f79535-47bb-0310-9956-ffa450edef68

src/main/http_main.c

index 282a9557f9e9b29bba061fc1b245f9b9934265b6..6bd8dce1c20d2007a193456ee472768d4e548312 100644 (file)
@@ -4980,6 +4980,14 @@ static void process_child_status(int pid, ap_wait_t status)
        */
     if ((WIFEXITED(status)) &&
        WEXITSTATUS(status) == APEXIT_CHILDFATAL) {
+        /* cleanup pid file -- it is useless after our exiting */
+        const char *pidfile = NULL;
+        pidfile = ap_server_root_relative (pconf, ap_pid_fname);
+        if ( pidfile != NULL && unlink(pidfile) == 0)
+            ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO,
+                         server_conf,
+                         "removed PID file %s (pid=%ld)",
+                         pidfile, (long)getpid());
        ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, server_conf,
                        "Child %d returned a Fatal error... \n"
                        "Apache is exiting!",