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 2002/04/17 00:36:46 UTC

DO NOT REPLY [Bug 8179] New: - excessive error output from script makes Apache 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=8179>.
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=8179

excessive error output from script makes Apache hang

           Summary: excessive error output from script makes Apache hang
           Product: Apache httpd-1.3
           Version: 1.3.24
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: mod_cgi
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: justdave@syndicomm.com


I have a Perl CGI which simply pulls data from a database and dumps it to a
table on a web page.  I was having a lot of trouble with the script hanging if
it pulled more than X rows from the database, where X was usually some number
between 15 and 25, but didn't seem to be a specific number, although the number
was always the same if I ran the same query.  Using the trace function of DBI
identified that the script was not hanging in DBI, but somewhere in the Perl
code between executions of $sth->fetchrow_array to retrieve data from the
database.  Running the script from the command line and redirecting output to a
file worked fine, it didn't hang, which seemed to implicate Apache as a
mitigating factor in the problem.  Putting print statements to a separate
logfile between every line of code narrowed it down to a print statement OR a
variable assignment.  The root cause of the problem (and hence how I fixed it)
was NULL values in the database.  Checking those values first and converting
them to empty strings stopped the script from hanging.

So then I set off to find out why running the script as a CGI would cause an
uninitialized value in a concatenation to hang when running it from the command
line would not...   and the result is: when you have such an error, Perl outputs
a warning to STDERR.  This is trapped by Apache and written to the error log. 
Apparently due to the sheer volume of the output to STDERR, Apache was getting
overwhelmed by it or something.  The magic number seems to be right around 4K.

I tested this with a script which did nothing but output data to STDERR, and
indeed the script hung right about the point it hit the 4K mark.  When the
script hangs, nothing is actually written to the error log.  So Apache must be
caching the STDERR output in a 4K buffer and not flushing it frequently enough?

This is on Windows 2000 Professional running ApacheNT 1.3.24 as a service, with
ActivePerl 5.6.1 as the Perl environment.

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