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/08/22 03:31:56 UTC

DO NOT REPLY [Bug 10515] - cgi lock when writing to stderr

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=10515>.
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=10515

cgi lock when writing to stderr





------- Additional Comments From notgod@notgod.com  2002-08-22 01:31 -------
This is an apache-2.0 only issue.  1.3 does not exhibit this problem, and is
seriously hampering development for us.  

"Deferring your stderr logging until the entire body is read and the entire
response is written." doesn't work for large scripts, sites, development
environments, etc.  

Also, this system will hang with as little as 4k of std_err action at leasr on
RH 6.soemthing, apache 2.0.40...  FreeBSD seems immune to this wackyness....

for example:
// Credit to: K.C. Wong
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <fcntl.h>

#define SIZE 4075

void out_err()
{
	char buffer[SIZE];
	int i = 0;

	for (i = 0; i < SIZE - 1; ++i)
		buffer[i] = 'a' + (char )(i % 26);

	buffer[SIZE - 1] = '\0';

//
fcntl(2, F_SETFL, fcntl(2, F_GETFL) | O_NONBLOCK);

	fprintf(stderr, "short test\n");
	fflush(stderr);

	fprintf(stderr, "test error=%s\n", buffer);
	fflush(stderr);
} // out_err()

int main(int argc, char ** argv)
{
	fprintf(stdout, "Context-Type: text/html\r\n");
	fprintf(stdout, "\r\n\r\n");
	out_err();
	fprintf(stdout, "<HTML>\n");
	fprintf(stdout, "<body>\n");
	fprintf(stdout, "<h1>hello world</h1>\n");
	fprintf(stdout, "</body>\n");
	fprintf(stdout, "</HTML>\n");
	fflush(stdout);
	exit(0);
} // main()

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