You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rob Hartill <ro...@imdb.com> on 1997/02/14 02:26:32 UTC

CGI hangs. Fix ?

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);
        send_http_header(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)
          continue;




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.


rob