From: Jeff Trawick Date: Sat, 13 Dec 2003 22:18:13 +0000 (+0000) Subject: Fix some piped log problems: bogus "piped log program '(null)' X-Git-Tag: pre_ajp_proxy~927 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=04980bafabd9b9e2bd0a2a9d6fd1f47a08394474;p=apache Fix some piped log problems: bogus "piped log program '(null)' failed" messages during restart and problem with the logger respawning again after Apache is stopped. PR: 21648, 24805 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102048 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 3899cd0c73..ecd16a24d5 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,11 @@ Changes with Apache 2.1.0-dev [Remove entries to the current 2.0 section below, when backported] + *) Fix some piped log problems: bogus "piped log program '(null)' + failed" messages during restart and problem with the logger + respawning again after Apache is stopped. PR 21648, PR 24805. + [Jeff Trawick] + *) Add a hook (insert_error_filter) to allow filters to re-insert themselves during processing of error responses. Enable mod_expires to use the new hook to include Expires headers in valid error diff --git a/server/log.c b/server/log.c index e01d10f45d..4b4f870be6 100644 --- a/server/log.c +++ b/server/log.c @@ -91,6 +91,7 @@ #include "http_log.h" #include "http_main.h" #include "util_time.h" +#include "ap_mpm.h" typedef struct { char *t_name; @@ -796,26 +797,34 @@ static void piped_log_maintenance(int reason, void *data, apr_wait_t status) { piped_log *pl = data; apr_status_t stats; + int mpm_state; switch (reason) { case APR_OC_REASON_DEATH: case APR_OC_REASON_LOST: - ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, - "piped log program '%s' failed unexpectedly", - pl->program); - pl->pid = NULL; + pl->pid = NULL; /* in case we don't get it going again, this + * tells other logic not to try to kill it + */ apr_proc_other_child_unregister(pl); - if (pl->program == NULL) { - /* during a restart */ - break; + stats = ap_mpm_query(AP_MPMQ_MPM_STATE, &mpm_state); + if (stats != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, + "can't query MPM state; not restarting " + "piped log program '%s'", + pl->program); } - if ((stats = piped_log_spawn(pl)) != APR_SUCCESS) { - /* what can we do? This could be the error log we're having - * problems opening up... */ - char buf[120]; + else if (mpm_state != AP_MPMQ_STOPPING) { ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, - "piped_log_maintenance: unable to respawn '%s': %s", - pl->program, apr_strerror(stats, buf, sizeof(buf))); + "piped log program '%s' failed unexpectedly", + pl->program); + if ((stats = piped_log_spawn(pl)) != APR_SUCCESS) { + /* what can we do? This could be the error log we're having + * problems opening up... */ + char buf[120]; + ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, + "piped_log_maintenance: unable to respawn '%s': %s", + pl->program, apr_strerror(stats, buf, sizeof(buf))); + } } break; @@ -825,9 +834,9 @@ static void piped_log_maintenance(int reason, void *data, apr_wait_t status) break; case APR_OC_REASON_RESTART: - pl->program = NULL; if (pl->pid != NULL) { apr_proc_kill(pl->pid, SIGTERM); + pl->pid = NULL; } break;