httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Hartill <>
Subject CGI hangs. Fix ?
Date Fri, 14 Feb 1997 01:26:32 GMT

I'm waitng to hear back from the latest bug-reporter, but I think this
must be the cause/fix ...

Index: mod_cgi.c
RCS file: /export/home/cvs/apache/src/mod_cgi.c,v
retrieving revision 1.8
diff -u -r1.8 mod_cgi.c
--- mod_cgi.c   1997/02/13 19:29:01     1.8
+++ mod_cgi.c   1997/02/13 23:31:08
@@ -500,7 +500,8 @@
        hard_timeout ("send script output", r);
-        if(!r->header_only) send_fd (script_in, r);
+       if(!r->header_only && send_fd (script_in, r) > 0)
+               bflush(r->connection->client);
        /* Soak up stderr */
        while (fgets(argsbuffer, HUGE_STRING_LEN-1, script_err) != NULL)

The bflush was removed from "send_fd" early in 1.2b[56]. I suspect that
on some "slow" systems the CGI is hanging on while it tries to cleanup
and die. The lack of the flush (for efficiency in persistent connections)
is (I reckon) enough to let Apache reach the CGI cleanup code before
the script can self destruct. On some systems/CGI/loads the CGI can't
die fast enough and Apache goes after it ruthlessly and with the 3s
delay as a consequence.

I couldn't get any of that olde CGI stuff to misbehave on my home machine
so this is still all theory.


View raw message