Browse Source

[mod_fastcgi,mod_scgi] backend spawn EINTR retry (#2788)

When spawning backends, retry blocking connect() to backend if EINTR
received when attempting to see if backend is already running.  EINTR
might be received if a HUP or USR1 signal is received while connecting
(or SIGCHLD on systems without SA_RESTART)

(expected to occur extremely rarely, but simple to handle properly)

x-ref:
  "FreeBSD/1.4.45/SSL: requests getting stuck in handle-req state occasionally"
  https://redmine.lighttpd.net/issues/2788
personal/stbuehler/mod-csrf
Glenn Strauss 5 years ago
parent
commit
aa923e05f6
  1. 5
      src/mod_fastcgi.c
  2. 5
      src/mod_scgi.c

5
src/mod_fastcgi.c

@ -1001,7 +1001,10 @@ static int fcgi_spawn_connection(server *srv,
return -1;
}
if (-1 == connect(fcgi_fd, fcgi_addr, servlen)) {
do {
status = connect(fcgi_fd, fcgi_addr, servlen);
} while (-1 == status && errno == EINTR);
if (-1 == status) {
/* server is not up, spawn it */
pid_t child;
int val;

5
src/mod_scgi.c

@ -771,7 +771,10 @@ static int scgi_spawn_connection(server *srv,
return -1;
}
if (-1 == connect(scgi_fd, scgi_addr, servlen)) {
do {
status = connect(scgi_fd, scgi_addr, servlen);
} while (-1 == status && errno == EINTR);
if (-1 == status) {
/* server is not up, spawn in */
pid_t child;
int val;

Loading…
Cancel
Save