DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7617>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7617

Apache 1.3.x race condition causes gratuitous 3-second CGI delay





------- Additional Comments From [EMAIL PROTECTED]  2002-10-24 14:14 -------
A few random thoughts...

Does "SetEnv nokeepalive" inside container for CGI directory help?

---/---

Note that mod_cgi already plays a game to avoid the possibility of delay
when the CGI is run as a subrequest.  See the comment, and the pool
passed to ap_bspawn_child():

    /*
     * we spawn out of r->main if it's there so that we can avoid
     * waiting for free_proc_chain to cleanup in the middle of an
     * SSI request -djg
     */
    if (!ap_bspawn_child(r->main ? r->main->pool : r->pool, cgi_child,
                         (void *) &cld, kill_after_timeout,
                         &script_out, &script_in, &script_err)) {
        ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
                    "couldn't spawn child process: %s", r->filename);
        return HTTP_INTERNAL_SERVER_ERROR;
    }

If the pool were r->connection->pool, the cleanup (and possible sleeping)
wouldn't happen until a point where it wouldn't hold up output for the client,
but on the other hand you could have undesired storage growth if many
CGIs were run on the same connection. You'd need to tune MaxKeepAliveRequests
accordingly.

---/---

Another possible kludge:

save the CGI process pid (retcode from ap_bspawn_child()), then after the 
call "ap_send_fb(script_in, r)" to send the output of the CGI, do this:

  if (kill(saved_pid, 0) == 0) { /* child process still alive */
    ap_rflush(r);  /* flush any held output to the client before we
                    * risk waiting for the CGI process to exit
                    */
  }

--/--

It might be useful to change free_proc_change() to sleep first for
300ms or so instead of 3 seconds.  But it shouldn't start sending
signals any sooner than the current code does.  It just should be
able to reap status sooner.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to