[libev/cgi] fix waitpid ECHILD errors in cgi with libev (fixes #2324)

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2816 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.30
Stefan Bühler 2011-12-18 12:58:04 +00:00
parent 7bdb75fb47
commit 761bedd7fe
3 changed files with 18 additions and 0 deletions

1
NEWS
View File

@ -15,6 +15,7 @@ NEWS
* [ssl] add option to honor server cipher order (fixes #2364, BEAST attack)
* [core] accept dots in ipv6 addresses in host header (fixes #2359)
* [ssl] fix ssl connection aborts if files are larger than the MAX_WRITE_LIMIT (256kb)
* [libev/cgi] fix waitpid ECHILD errors in cgi with libev (fixes #2324)
- 1.4.29 - 2011-07-03
* Fix mod_proxy waiting for response even if content-length is 0 (fixes #2259)

View File

@ -1288,6 +1288,15 @@ TRIGGER_FUNC(cgi_trigger) {
#endif
break;
case -1:
if (errno == ECHILD) {
/* someone else called waitpid... remove the pid to stop looping the error each time */
log_error_write(srv, __FILE__, __LINE__, "s", "cgi child vanished, probably someone else called waitpid");
cgi_pid_del(srv, p, p->cgi_pid.ptr[ndx]);
ndx--;
continue;
}
log_error_write(srv, __FILE__, __LINE__, "ss", "waitpid failed: ", strerror(errno));
return HANDLER_ERROR;

View File

@ -1120,6 +1120,14 @@ int main (int argc, char **argv) {
"s", "fdevent_init failed");
return -1;
}
/* libev backend overwrites our SIGCHLD handler and calls waitpid on SIGCHLD; we want our own SIGCHLD handling. */
#ifdef HAVE_SIGACTION
sigaction(SIGCHLD, &act, NULL);
#elif defined(HAVE_SIGNAL)
signal(SIGCHLD, signal_handler);
#endif
/*
* kqueue() is called here, select resets its internals,
* all server sockets get their handlers