I fixed a nasty bug in http_protocol.c where
while ((n= fread(buf, sizeof(char), IOBUFSIZE, f)) < 1
&& errno == EINTR)
continue;
gets into an endless loop on our solaris machine. Seems that if
a document contains the output of a script that fails, any
file I/O after that causes the httpd process to spin forever (no
alarm is set at this point since it was cleared by the spawn
code in alloc I think).
The "nasty" is the errno is set to EINTR (from the last timeout)
but fread is returning with an EOF condition (errno was not reset
since no error occured). Some OSs can handle this since they reset
errno, but apparently not solaris.
Since the man page for fread does say :
The ferror() or feof() routines must be used to distinguish
between an error condition and end-of-file condition.
I changed it to:
while ((n= fread(buf, sizeof(char), IOBUFSIZE, f)) < 1
&& ferror(f) && errno == EINTR)
continue;
And all is well :)
This may be the solaris nasty people have been hitting.
Cliff
while ((n= fread(buf, sizeof(char), IOBUFSIZE, f)) < 1
&& errno == EINTR)
continue;
gets into an endless loop on our solaris machine. Seems that if
a document contains the output of a script that fails, any
file I/O after that causes the httpd process to spin forever (no
alarm is set at this point since it was cleared by the spawn
code in alloc I think).
The "nasty" is the errno is set to EINTR (from the last timeout)
but fread is returning with an EOF condition (errno was not reset
since no error occured). Some OSs can handle this since they reset
errno, but apparently not solaris.
Since the man page for fread does say :
The ferror() or feof() routines must be used to distinguish
between an error condition and end-of-file condition.
I changed it to:
while ((n= fread(buf, sizeof(char), IOBUFSIZE, f)) < 1
&& ferror(f) && errno == EINTR)
continue;
And all is well :)
This may be the solaris nasty people have been hitting.
Cliff