httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dan kelley <>
Subject mod_cgi kills CGI subprocesses after 3 seconds
Date Tue, 29 Jan 2002 15:52:28 GMT


i'm having some difficulty with CGI subprocess being killed by apache
shortly after they close stdout.  we have some CGI programs that continue
to do background processing after they've finished returing data to the
client, so it would be beneficial to us to be able to change this

it looks like mod_cgi.c defaults to sending subprocesses SIGTERM
immediately after the subprocess closes stdout, then SIGKILL 3 seconds

from mod_cgi.c:

if (!ap_bspawn_child(r->main ? r->main->pool : r->pool, cgi_child,
                         (void *) &cld, kill_after_timeout,
                         &script_out, &script_in, &script_err))

from ap_alloc.h:

enum kill_conditions {
    kill_never,                 /* process is never sent any signals */
    kill_always,                /* process is sent SIGKILL on pool cleanup */
    kill_after_timeout,         /* SIGTERM, wait 3 seconds, SIGKILL */
    just_wait,                  /* wait forever for the process to complete */
    kill_only_once              /* send SIGTERM and then wait */

it looks like we could change the behavior of mod_cgi to better fit what
we need to do by simply changing the 4th arg of ap_bspawn_child in
mod_cgi.c from kill_after_timeout to kill_never.

question: is there currently any way to do this with a config directive?
i've looked through the FAQ, the CGI docs, and a mail archive, but didn't
find anything that suggested such a config directive existed.  if there
isin't, would there be any obvious disadvantage to implementing one?



The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message