]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Fix some piped log problems: bogus "piped log program '(null)'
authorJustin Erenkrantz <jerenkrantz@apache.org>
Mon, 8 Mar 2004 23:12:44 +0000 (23:12 +0000)
committerJustin Erenkrantz <jerenkrantz@apache.org>
Mon, 8 Mar 2004 23:12:44 +0000 (23:12 +0000)
failed" messages during restart and problem with the logger
respawning again after Apache is stopped.

PR: 21648, 24805
Reviewed by: trawick, jerenkrantz, nd

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

CHANGES
server/log.c

diff --git a/CHANGES b/CHANGES
index 27ef69fe3c44f8ae473048b4e9de47c8070f2d3f..c0d2ca00c1b5ceefd1771d700c6c247ba009c539 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,10 @@
 Changes with Apache 2.0.49
 
+  *) 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]
+
   *) Fixed file extensions for real media files and removed rpm extension
      from mime.types. PR 26079.  [Allan Sandfeld <kde carewolf.com>]
 
index 510c991766ae6ab1090687b8834b187be8e2373d..ba491148ca6395816529315bfddc9e0630c9c365 100644 (file)
@@ -48,6 +48,7 @@
 #include "http_log.h"
 #include "http_main.h"
 #include "util_time.h"
+#include "ap_mpm.h"
 
 typedef struct {
     char    *t_name;
@@ -769,26 +770,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;
 
@@ -798,9 +807,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;