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/07/31 21:33:00 UTC
DO NOT REPLY [Bug 22030] New: -
4097+ bytes of stderr from cgi script causes script to hang
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=22030>.
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=22030
4097+ bytes of stderr from cgi script causes script to hang
Summary: 4097+ bytes of stderr from cgi script causes script to
hang
Product: Apache httpd-2.0
Version: 2.0.47
Platform: PC
OS/Version: Linux
Status: NEW
Severity: Normal
Priority: Other
Component: mod_cgi
AssignedTo: bugs@httpd.apache.org
ReportedBy: brandon@tryplec.com
If a cgi script under mod_cgi outputs more than 4096 bytes of stderr before it
finishes writing to and closing its stdout, the write() inthe cgi script
containing the 4097th byte of stderr will hang indefinitely, hanging the
script's execution.
This appears to be cause by the fact that mod_cgi reads all stdout output
first, and then begins reading stderr output. APR's file_io which is handling
the streams will only buffer 4096 characters before further writes by the
script to stderr will hang, waiting for mod_cgi to read some of the data from
the stream via APR file_io.
This occured for me where a perl cgi script was producing a large volume of
harmless warning messages to ssl_error_log before it got to the part of it's
execution where it actually wrote the stdout output, and causing the script to
hang and produce no output to the end user. Below is a test script to
demonstrate:
#!/usr/bin/perl
# 24x170 = 4080 bytes to stderr
foreach my $x (1..24) {
print STDERR 'X' x 169 . "\n";
}
# + 17 more bytes, putting us at 4097
# Delete one char from the print below to make
# it work again
print STDERR "0123456789ABCDEF\n";
# Our actual script output, which never comes
print "Content-type: text/plain\n\nASDF\n";
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org