With this newer patch, the behavior w.r.t. pid file cleanup and SIGTERM messages should be consistent between prefork and worker. Neither pid file cleanup nor the SIGTERM message is issued.
I expect that other MPMs which call ap_process_child_status (beos, perchild, threaded) would be modified in the same way as worker. Index: server/mpm_common.c =================================================================== RCS file: /cvs/apache/httpd-2.0/server/mpm_common.c,v retrieving revision 1.70 diff -u -r1.70 mpm_common.c --- mpm_common.c 2001/10/23 17:30:07 1.70 +++ mpm_common.c 2001/11/16 13:45:38 @@ -225,21 +225,24 @@ #endif /* AP_MPM_WANT_WAIT_OR_TIMEOUT */ #ifdef AP_MPM_WANT_PROCESS_CHILD_STATUS -void ap_process_child_status(apr_proc_t *pid, apr_exit_why_e why, int status) +int ap_process_child_status(apr_proc_t *pid, apr_exit_why_e why, int status) { int signum = status; const char *sigdesc = apr_signal_get_description(signum); /* Child died... if it died due to a fatal error, - * we should simply bail out. - */ + * we should simply bail out. The caller needs to + * check for bad rc from us and exit, running any + * appropriate cleanups. + */ if ((APR_PROC_CHECK_EXIT(why)) && (status == APEXIT_CHILDFATAL)) { ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, 0, ap_server_conf, - "Child %ld returned a Fatal error..." APR_EOL_STR - "Apache is exiting!", - (long)pid->pid); - exit(APEXIT_CHILDFATAL); + "Child %" APR_OS_PROC_T_FMT + " returned a Fatal error..." APR_EOL_STR + "Apache is exiting!", + pid->pid); + return APEXIT_CHILDFATAL; } if (APR_PROC_CHECK_SIGNALED(why)) { Index: server/mpm/prefork/prefork.c =================================================================== RCS file: /cvs/apache/httpd-2.0/server/mpm/prefork/prefork.c,v retrieving revision 1.211 diff -u -r1.211 prefork.c --- prefork.c 2001/11/11 05:17:51 1.211 +++ prefork.c 2001/11/16 13:45:38 @@ -1126,7 +1126,10 @@ * extra child */ if (pid.pid != -1) { - ap_process_child_status(&pid, exitwhy, status); + if (ap_process_child_status(&pid, exitwhy, status) == APEXIT_CHILDFATAL) { + return 1; + } + /* non-fatal death... note that it's gone in the scoreboard. */ ap_sync_scoreboard_image(); child_slot = find_child_by_pid(&pid); Index: server/mpm/worker/worker.c =================================================================== RCS file: /cvs/apache/httpd-2.0/server/mpm/worker/worker.c,v retrieving revision 1.34 diff -u -r1.34 worker.c --- worker.c 2001/11/12 17:50:59 1.34 +++ worker.c 2001/11/16 13:45:38 @@ -302,6 +302,7 @@ static int volatile restart_pending; static int volatile is_graceful; ap_generation_t volatile ap_my_generation; +static volatile int child_fatal; /* * ap_start_shutdown() and ap_start_restart(), below, are a first stab at @@ -1195,7 +1197,11 @@ ap_wait_or_timeout(&exitwhy, &status, &pid, pconf); if (pid.pid != -1) { - ap_process_child_status(&pid, exitwhy, status); + if (ap_process_child_status(&pid, exitwhy, status) == APEXIT_CHILDFATAL) { + shutdown_pending = 1; + child_fatal = 1; + return; + } /* non-fatal death... note that it's gone in the scoreboard. */ child_slot = find_child_by_pid(&pid); if (child_slot >= 0) { @@ -1359,9 +1365,9 @@ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "killpg SIGTERM"); } ap_reclaim_child_processes(1); /* Start with SIGTERM */ - - /* cleanup pid file on normal shutdown */ - { + + if (!child_fatal) { + /* cleanup pid file on normal shutdown */ const char *pidfile = NULL; pidfile = ap_server_root_relative (pconf, ap_pid_fname); if ( pidfile != NULL && unlink(pidfile) == 0) @@ -1369,11 +1375,10 @@ ap_server_conf, "removed PID file %s (pid=%ld)", pidfile, (long)getpid()); - } - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf, - "caught SIGTERM, shutting down"); + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, + ap_server_conf, "caught SIGTERM, shutting down"); + } return 1; } -- Jeff Trawick | [EMAIL PROTECTED] | PGP public key at web site: http://www.geocities.com/SiliconValley/Park/9289/ Born in Roswell... married an alien...