Browse Source

Fix EINTR handling for waitpid in mod_fastcgi

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2264 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.20
Stefan Bühler 14 years ago
parent
commit
a7f5983e05
  1. 1
      NEWS
  2. 60
      src/mod_fastcgi.c

1
NEWS

@ -42,6 +42,7 @@ NEWS
* handle EAGAIN and EINTR for freebsd sendfile (#1675)
* Use filedescriptor 0 for mod_scgi spawn socket, redirect STDERR to /dev/null (#1716)
* fixed round-robin balancing in mod_proxy (#1715)
* fixed EINTR handling for waitpid in mod_fastcgi
- 1.4.19 - 2008-03-10

60
src/mod_fastcgi.c

@ -2681,30 +2681,48 @@ static int fcgi_restart_dead_procs(server *srv, plugin_data *p, fcgi_extension_h
/* the child should not terminate at all */
switch(waitpid(proc->pid, &status, WNOHANG)) {
case 0:
/* child is still alive */
break;
case -1:
break;
default:
if (WIFEXITED(status)) {
for ( ;; ) {
switch(waitpid(proc->pid, &status, WNOHANG)) {
case 0:
/* child is still alive */
if (srv->cur_ts <= proc->disabled_until) break;
proc->state = PROC_STATE_RUNNING;
host->active_procs++;
log_error_write(srv, __FILE__, __LINE__, "sbdb",
"fcgi-server re-enabled:",
host->host, host->port,
host->unixsocket);
break;
case -1:
if (errno == EINTR) continue;
log_error_write(srv, __FILE__, __LINE__, "sd",
"child died somehow, waitpid failed:",
errno);
proc->state = PROC_STATE_DIED;
break;
default:
if (WIFEXITED(status)) {
#if 0
log_error_write(srv, __FILE__, __LINE__, "sdsd",
"child exited, pid:", proc->pid,
"status:", WEXITSTATUS(status));
log_error_write(srv, __FILE__, __LINE__, "sdsd",
"child exited, pid:", proc->pid,
"status:", WEXITSTATUS(status));
#endif
} else if (WIFSIGNALED(status)) {
log_error_write(srv, __FILE__, __LINE__, "sd",
"child signaled:",
WTERMSIG(status));
} else {
log_error_write(srv, __FILE__, __LINE__, "sd",
"child died somehow:",
status);
} else if (WIFSIGNALED(status)) {
log_error_write(srv, __FILE__, __LINE__, "sd",
"child signaled:",
WTERMSIG(status));
} else {
log_error_write(srv, __FILE__, __LINE__, "sd",
"child died somehow:",
status);
}
proc->state = PROC_STATE_DIED;
break;
}
proc->state = PROC_STATE_DIED;
break;
}

Loading…
Cancel
Save