I need help with a "Premature end of script headers:" Apache/CGI problem, but it is not the normal situation where this error occurs. That is, it doesn't happen all the time.

When I start Apache, everything works fine, for about a day or so (thought not exactly a day). After the critical time passes, all attempted regular executions (not under mod_perl) of Perl CGI scripts end with a 500 error and "Premature end of script headers:" in the Apache error log.

I was running 2.2.8 on Windows with ActiveState build 5.8.8 Build 222. I just upgraded to 2.2.9 in hope it will fix this problem, though I doubt it.

I've looked at permissions and various httpd.conf settings including ScriptInterpreterSource (and messing with the shebang line). I've tried using Carp, but no errors get printed to the browser and nothing more gets printed in the Apache error log with LogLevel Debug. Also, nothing is in the Event Viewer (although I wouldn't expect anything).

Another interesting wrinkle is that when the switch happens and regular CGI scripts fail across the board, CGI scripts run under mod_perl (even the same scripts) continue to work just fine.

Of course, restarting the server corrects the problem (until it happens again in another day or so).

Oh, and I've also tried load testing CGI scripts to see if it reaches a certain threshold # of requests it will kick over. This didn't work either.

Any ideas would obviouslly be appreciated. I have a 10 min monitor on a script now so I'll know when it goes down again.


In reply to Not your normal " Premature end of script headers:" by yegg

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.