More EINTR fixes
Artur Zaprzala <[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Message-ID | <[email protected]> |
mod_fastcgi doesn't handle all EINTR errors, which can happen when Apache is running in a multi-threaded mode and is keeping up with MaxSpareThreads or is doing a graceful restart. Below is a patch against mod_fastcgi-SNAP-0809231057. I fixed this about 3 years ago, so it is well tested now. _______________________________________________ FastCGI-developers mailing list FastCGI-developers-xGejAJT2w6xVgU18Zptdi0EOCMrvLtNR@public.gmane.org http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers
mod_fastcgi-eintr.patch
(text/x-patch, 1.2 KB)
EINTR can happend when Apache is keeping up with MaxSpareThreads or is doing a graceful restart.
--- mod_fastcgi.c-orig 2008-09-23 16:56:45.000000000 +0200
+++ mod_fastcgi.c 2008-11-03 18:48:36.000000000 +0100
@@ -1371,8 +1371,10 @@
}
/* Connect */
- if (connect(fr->fd, (struct sockaddr *)socket_addr, socket_addr_len) == 0)
- goto ConnectionComplete;
+ do
+ if (connect(fr->fd, (struct sockaddr *)socket_addr, socket_addr_len) == 0)
+ goto ConnectionComplete;
+ while (errno==EINTR);
#ifdef WIN32
@@ -1416,7 +1418,9 @@
tval.tv_sec = dynamicPleaseStartDelay;
tval.tv_usec = 0;
- status = ap_select((fr->fd+1), &read_fds, &write_fds, NULL, &tval);
+ do
+ status = ap_select((fr->fd+1), &read_fds, &write_fds, NULL, &tval);
+ while (status<0 && errno==EINTR);
if (status < 0)
break;
@@ -1445,7 +1449,9 @@
FD_SET(fr->fd, &write_fds);
read_fds = write_fds;
- status = ap_select((fr->fd+1), &read_fds, &write_fds, NULL, &tval);
+ do
+ status = ap_select((fr->fd+1), &read_fds, &write_fds, NULL, &tval);
+ while (status<0 && errno==EINTR);
if (status == 0) {
ap_log_rerror(FCGI_LOG_ERR_NOERRNO, r,