From d4c03d1097c1567148ec005f344c1b0b70a3b362 Mon Sep 17 00:00:00 2001 From: Martin Kraemer Date: Mon, 21 Oct 2002 13:41:57 +0000 Subject: [PATCH] When we detect a child exiting with APEXIT_CHILDFATAL in process_child_status(), 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 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/http_main.c b/src/main/http_main.c index 282a9557f9e..6bd8dce1c20 100644 --- a/src/main/http_main.c +++ b/src/main/http_main.c @@ -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!", -- 2.47.2