I have a cgi code that is being called by AJAX from clientside javascript. However, the result of the call is discarded by the client.
On the backend this code occurs:
$|=1;
my $i = 0;
while (<$fh_echo>)
{
#To prevent apache timing out the cgi script.
print "." if $i % 100 == 0;
#Do stuff
$i++;
}
Despite the periodic print out, this still times out:
[warn] [client 10.23.12.87] Timeout waiting for output from CGI script
[error] [client 10.23.12.87] (70007)The timeout specified has expired: ap_content_length_filter: apr_bucket_read() failed
I figure the fact that javascript discards the output shouldn’t have any form of impact on whether or not apache allows the cgi script to continue. If so, then what is happening here?
Disabling the timeout for CGI scripts is asking for trouble. Given that the result of the call is discarded by the client, you should instead
fork, have the child complete the work and the parent finish quickly.See Watching long processes through CGI for an explanation. Specifically,