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

Rob Saccoccio robs at fastcgi.com
Sun Sep 21 15:35:46 EDT 2008

Hi Rainer.  Thanks for the patches.  

Comments below.

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

Your EAGAIN handling doesn't appear to do what you intended.  As written,
the request is prematurely terminated without setting an error.  Moving the
break up into the else clause is what I think you wanted. 

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

I've incorporated handling for EINTR on the select(). I removed the sleep().
Is there a reason you believe that it is required?


More information about the FastCGI-developers mailing list