On Fri, Oct 22, 2021 at 8:49 PM miim <xxdpp...@yahoo.com.invalid> wrote: > > I have a relatively simple module which is nonetheless causing Apache to > intermittently segfault. > > I've added debugging trace messages to be sent to the error log, but the lack > of anything in the log at the time of the segfault leads me to think that the > error log is not flushed when a message is sent. For example, a segfault > occurs at 00:18:04, last previous request was at 00:15:36, so clearly the new > request caused the segfault. But not even the "Here I am at the handler > entry point" (see below) gets into the logfile before the server log reports > a segfault taking down Apache. > > > /* Retrieve the per-server configuration */ > mod_bc_config *bc_scfg = ap_get_module_config(r->server->module_config, > &bridcheck_module); > if (bc_scfg->bc_logdebug & 0x0020000000000) > ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, > "mod_bridcheck: Enter bridcheck_handler"); > > > I could turn on core dumping but (a) I am no expert at decoding core dumps > and (b) I don't want to dump this problem on somebody else.
I think this is probably the best way to go, even if you don't go farther than the stack which is not a lot. It is a good skill to build anyway. An alternative is to get backtraces in the error_log: https://emptyhammock.com/projects/httpd/diag/ > So ... is there a way to force Apache to flush the error log before > proceeding? It is probably memory corruption that clobbers some memory used by a different module on a later request. I've not really seen buffering of these kinds of messages at all in httpd. On linux running the server with environment variable MALLOC_CHECK_=2 might get it to crash earlier/closer to the mismanagement. Or running it under valgrind if you can do it in a low-load environment. -- Eric Covener cove...@gmail.com