Tobias Diedrich wrote:
> However I think sleeping 1s before retrying is unnecessary (and having a
> maximum amount of retries might be a bit paranoid), so I'm not saying this
> patch should be applied as-is.

I'm using the following modified patch now:

Index: libapache-mod-fastcgi-2.4.2/mod_fastcgi.c
===================================================================
--- libapache-mod-fastcgi-2.4.2.orig/mod_fastcgi.c      2008-11-02 
16:42:49.000000000 +0000
+++ libapache-mod-fastcgi-2.4.2/mod_fastcgi.c   2008-11-02 16:50:46.000000000 
+0000
@@ -2178,12 +2178,15 @@
         }
 
         /* wait on the socket */
-        select_status = ap_select(nfds, &read_set, &write_set, NULL, &timeout);
+        /* Interrupted system calls do happen now and then, so retry on EINTR 
*/
+        do {
+            select_status = ap_select(nfds, &read_set, &write_set, NULL, 
&timeout);
+        } while (select_status < 0 && errno == EINTR);
 
         if (select_status < 0)
         {
             ap_log_rerror(FCGI_LOG_ERR_ERRNO, r, "FastCGI: comm with server "
-                "\"%s\" aborted: select() failed", fr->fs_path);
+                "\"%s\" aborted: select() failed: \"%s\"", fr->fs_path, 
strerror(errno));
             state = STATE_ERROR;
             break;
         }
@@ -2246,11 +2249,19 @@
             }
 
             rv = fcgi_buf_socket_recv(fr->serverInputBuffer, fr->fd);
+            /*
+             * select(2) states: Under Linux, select() may report a socket
+             * file descriptor as "ready for reading", while nevertheless a
+             * subsequent read blocks.
+             * Act as if the FD was not set if socket_recv returns EAGAIN.
+             */
+            if (rv < 0 && errno == EAGAIN)
+                break;
 
             if (rv < 0) 
             {
                 ap_log_rerror(FCGI_LOG_ERR, r, "FastCGI: comm with server "
-                    "\"%s\" aborted: read failed", fr->fs_path);
+                    "\"%s\" aborted: read failed: \"%s\"", fr->fs_path, 
strerror(errno));
                 state = STATE_ERROR;
                 break;
             }

-- 
Tobias                                          PGP: http://9ac7e0bc.uguu.de
このメールは十割再利用されたビットで作られています。



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to