[FASTCGI] [Patch] Improve handling of interrupted system calls

Rainer Jung rainer.jung at kippdata.de
Tue Aug 5 18:39:05 EDT 2008


during stress tests we realized, that mod_fastcgi aborts requests in
some cases, where the root cause is an interrupted system call.

After adding a retry functionality, we noticed no more of these errors
and the responses were delivered with the correct content.

So I attach the patch we used.

Some comments:

There are two situations, that are handled by the patch:

A) After select() in socket_io() indicates, that the response can be
read, but the following readv() in fcgi_buf_socket_recv() returns with
EAGAIN. Normally this should not happen, but it isn't forbidden and at
least on AIX 5.2 we noticed exactly this behaviour. It only showed up
sporadically, but when it happens, because mod_fastcgi aborts the
request we get status codes 500.

B) select() in socket_io() can return with EINTR. We implemented a retry
loop, which sleep 1 second and loops max 10 times in order to prevent a
non terminating loop. We also noticed this behaviour on AIX 5.2 under
stress (sporadically). The loop never ran more than twice.

The one second sleep might not be ideal, but since the problem only
happens very rarely, it looked safer, than a shorter sleep.

Thanks for producing mod_fastcgi!



-------------- next part --------------
A non-text attachment was scrubbed...
Name: mod_fastcgi.c.patch
Type: text/x-patch
Size: 1759 bytes
Desc: not available
URL: <http://mailman.pins.net/mailman/private.cgi/fastcgi-developers/attachments/20080806/8277061f/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mod_fastcgi.h.patch
Type: text/x-patch
Size: 591 bytes
Desc: not available
URL: <http://mailman.pins.net/mailman/private.cgi/fastcgi-developers/attachments/20080806/8277061f/attachment-0001.bin>

More information about the FastCGI-developers mailing list