Hi,

mod_log_config contains these lines

static const char *set_buffered_logs_on(cmd_parms *parms, void *dummy, int 
flag)
{
    buffered_logs = flag;
    if (buffered_logs) {
        ap_log_set_writer_init(ap_buffered_log_writer_init);
        ap_log_set_writer(ap_buffered_log_writer);
    }
    return NULL;
}

The buffered_logs global variable reflects the BufferedLogs directive.

Now, if my config file contains the 2 lines

  BufferedLogs On
  BufferedLogs Off

in that order the first directive turns buffered logs on and sets the writer 
functions. The 2nd directive turns the buffered_logs flag off but doesn't 
reset the writer functions. Hence, if your config contains those lines the 
httpd will segfault at startup.

Further, when mod_log_config is compiled as a shared module it is unloaded and 
the global variables buffered_logs, log_writer and log_writer_init are reset 
during a restart via SIG{HUP,USR1}. But if the module is compiled statically 
those global variables keep their values and a similar situation as described 
above can appear.

I have found that in 2.2.17. But I have verified it is also present in trunk.

The enclosed patch cures the problem.

Torsten Förtsch

-- 
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net
--- modules/loggers/mod_log_config.c~	2010-08-24 08:41:38.000000000 +0200
+++ modules/loggers/mod_log_config.c	2011-03-03 13:31:11.018338617 +0100
@@ -1171,6 +1171,10 @@
         ap_log_set_writer_init(ap_buffered_log_writer_init);
         ap_log_set_writer(ap_buffered_log_writer);
     }
+    else {
+        ap_log_set_writer_init(ap_default_log_writer_init);
+        ap_log_set_writer(ap_default_log_writer);
+    }
     return NULL;
 }
 static const command_rec config_log_cmds[] =
@@ -1543,6 +1547,10 @@
         log_pfn_register(p, "R", log_handler, 1);
     }
 
+    buffered_logs = 0;
+    ap_log_set_writer_init(ap_default_log_writer_init);
+    ap_log_set_writer(ap_default_log_writer);
+
     return OK;
 }
 

Reply via email to