The following reply was made to PR general/3986; it has been noted by GNATS.
From: Peter Bonney <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Cc: "Richard Porter" <[EMAIL PROTECTED]>, Neil Savasta <[EMAIL PROTECTED]>, apache-bugdb@apache.org, [EMAIL PROTECTED] Subject: general/3986: Premature end of script headers Date: Fri, 12 Mar 1999 11:54:36 -0800 [EMAIL PROTECTED] wrote, : I don't quite see how this is an Apache bug. Is there something that : leads you to believe that Apache is causing some error? Are you sure : the code runs perfectly? I'll leave it to the reader to decide whether this problem reflects an Apache bug, a mod_perl bug, a documentation bug, or just a dumb-user bug... but we've at least got an answer on this one. We were able to determine that our cgi-bin scripts ran fine if the server was not executing any mod_perl scripts. However, when we invoked one of the scripts in our cgi-perl directory (configured, unsurprisingly, to use mod_perl), the cgi-bin scripts would start to fail (with 'Premature end of script headers'). At first, the failures would be rare, but the more times we invoked the script in cgi-perl, the more frequent the cgi-bin failures became. This strongly indicated that something which the cgi-perl script was doing was causing some sort of corruption in the httpd subprocess. It took a fair amount of digging (the culprit turned out to be in a secondary script which was being invoked as a side-effect of the primary script), but we found the problem: one of our scripts was doing a 'close STDOUT;' towards the end. This was added in the distant past presumably with the intent of flushing the output to the browser. Removing this line made everything healthy again. We presume that the filehandle/socket corresponding to STDOUT subsequently continued to be used (by mod_perl or Apache). Since the handle is closed at this point, the write is apparently doing unhealthy things to the webserver's process space. I don't know if there are (or should be) any checks in place in the server to prevent this sort of corruption; a simpler resolution might be to add a warning note to the mod_perl_traps document. -- Peter Bonney Senior Software Engineer (415) 882-9404 x814 [EMAIL PROTECTED] Citizen 1 Software, Inc. http://www.citeline.com/