We found a CGI script that called 'warn' too many times would hang the Perl process running under Apache (separate process). When you kill the process, the Apache error log then gets the first 648 calls to warn, but no more. This does not happen from the command line, nor running in the Eclipse CGI debugger (which doesn't use Apache).

The same thing happens if we merely print to STDOUT 1000 times; it hangs on 649 (based on browser stdout). 100 bytes per call * 648 = 64,800 bytes. (100 more bytes shouldn't be over 64*1024=65536 yet.)

Any ideas please?

env details:

  • Apache on windows (httpd-2.2.22-win32-x86-openssl-0.9.8t)
  • Perl v5.18.2 ( MSWin32-x86-multi-thread-64int - ActiveState)
  • Apache is running locally, writing to C:
  • You can try this with:

    #!C:\perl\bin\perl.exe use strict; select( STDERR ); $| = 1; select( STDOUT ); $| = 1; print <<HTML_HEADER; Content-type: text/plain <HTML> <head> <title>testWarn.pl</title> </head> <body style='background-color:#cccccc'> HTML_HEADER # Write to stdout lot of times... for ( my $lineNumber = 1; $lineNumber <= 1000; $lineNumber++ ) { print "$lineNumber...<br>\n"; my $errMsg = substr( "Line $lineNumber....." x 10, 0, 99) . "\n"; print STDERR $errMsg; #called 649, writes 648x successfully; + 648*100=64,800; 64*1024=65536 #warn( $errMsg); #called 649, write 648x successfully } print <<HTML_TRAILER; </body> </HTML> HTML_TRAILER
    Any help is appreciated.

    In reply to output to STDERR/warn hangs Perl under Apache at ~64,800 bytes by RockyMtn

    Title:
    Use:  <p> text here (a paragraph) </p>
    and:  <code> code here </code>
    to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.