You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2003/06/18 13:53:37 UTC

DO NOT REPLY [Bug 20866] New: - cgi script just hangs at end, then apr_bucket_read error

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=20866>.
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=20866

cgi script just hangs at end, then apr_bucket_read error

           Summary: cgi script just hangs at end, then apr_bucket_read error
           Product: Apache httpd-2.0
           Version: 2.0.45
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: mod_cgi
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: jon5@modem.org


This was very weird.

Absolutely no scripts or files changed on my website in the last 4 weeks.  
Apache 2.0.45 was installed on April 23 (two months ago).  As of 1.5 weeks ago, 
my logged in users were being delivered the page successfully, but the script 
just hangs at the end for exactly 5 minutes then it finished with this error 
written to the error-log file:

(70007)The timeout specified has expired: ap_content_length_filter: 
apr_bucket_read() failed

Basically the page would be delivered normally, but the web browser would 
appear to continue loading the page even though it was already fully 
delivered.  After 5 minutes of this, finally the webserver would say "done" and 
the browser would stop.

Because my database data does change very frequently, I first thought my 
database data was calling a broken image or something that would cause the 
browser to hang.  Nope.  Then I thought perhaps my perl cgi script was broken 
even though it hadn't changed.  But if a perl script actually pauses for 
minutes, I would expect ps to show the perl script still running, but it was 
not - ps showed no perl scripts running while the browser was waiting.

So I focused on Apache.  I read somewhere on bugzilla that apr_bucket_read is 
caused when a script does not finish in time for the KeepAliveTimeOut value.  
But I *know* my perl script never takes more than 3 seconds to run.  Something 
in Apache was timing out after 5 minutes because the access-log shows every 
access to the script would take 303 seconds (3 for it to run, and 300 seconds 
would be a timeout somewhere).  But why was Apache hanging on to the script for 
5 minutes??

I read somewhere on a google search that one person had a problem with Apache2 
and non-buffered output.  So I made just TWO changes to my entire perl script, 
I removed the $|++ command which turned off auto-flushed output thus enabling 
buffered output.  I also removed a line that simply warns me of a error:

warn "weird";

Now the problem went away!

Humm, I never noticed the warn command in any of my apache error logs, but this 
perl script was being called within another perl script, i wonder of a warn 
message (or a simple STDERR message) from a perl script called within another 
perl script could cause this problem?

I have an example of this problem here.

A page that does not have the problem:
http://www.hotdlz.com/apachebug1.pl

A page that DOES have the problem:
http://www.hotdlz.com/apachebug/

Both scripts do a require "/path/other-script.pl" inside.  The only difference 
between the two above scripts is they call a different /path/other-script.pl.  
The only difference between the two /path/other-script.pl's are the following:

$|++; is at the top, and
warn "something weird happened"; is located within a foreach loop through the 
data if something weird happens.

The broken script has these two lines, while the fixed script has these two 
lines taken out.

I hope this information helps in identifying the bug, or at least helps point 
someone else in the right direction to fixing the problem on their site.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org