Browse Source

mod_fastcgi: Don't reconnect after connect() succeeded (fixes #2096)

- a reconnect would try to rebuild the outgoing queue,
   which involves reusing the post body - but the first
   try already removed it.
   we could try reusing the queue, but otoh that really
   isn't our problem. accept() it - handle it.

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2692 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.25
Stefan Bühler 12 years ago
parent
commit
2eaf42d0e5
  1. 1
      NEWS
  2. 29
      src/mod_fastcgi.c

1
NEWS

@ -12,6 +12,7 @@ NEWS
* reset tlsext_server_name in connection_reset - fixes random hostnames in the $HTTP["host"] conditional
* export some SSL_CLIENT_* vars for client cert validation (fixes #1288, thx presbrey)
* mod_fastcgi: fix mod_fastcgi packet parsing
* mod_fastcgi: Don't reconnect after connect() succeeded (fixes #2096)
- 1.4.24 - 2009-10-25
* Add T_CONFIG_INT for bigger integers from the config (needed for #1966)

29
src/mod_fastcgi.c

@ -3081,34 +3081,17 @@ static handler_t fcgi_write_request(server *srv, handler_ctx *hctx) {
if (ret < 0) {
switch(errno) {
case EPIPE:
case ENOTCONN:
case ECONNRESET:
/* the connection got dropped after accept()
*
* this is most of the time a PHP which dies
* after PHP_FCGI_MAX_REQUESTS
*
*/
if (hctx->wb->bytes_out == 0 &&
hctx->reconnects < 5) {
usleep(10000); /* take away the load of the webserver
* to give the php a chance to restart
*/
fcgi_reconnect(srv, hctx);
return HANDLER_WAIT_FOR_FD;
}
/* not reconnected ... why
*
* far@#lighttpd report this for FreeBSD
*
* we don't care about that - if you accept() it, you have to handle it.
*/
log_error_write(srv, __FILE__, __LINE__, "ssosd",
"[REPORT ME] connection was dropped after accept(). reconnect() denied:",
log_error_write(srv, __FILE__, __LINE__, "ssosb",
"connection was dropped after accept() (perhaps the fastcgi process died),",
"write-offset:", hctx->wb->bytes_out,
"reconnect attempts:", hctx->reconnects);
"socket:", hctx->proc->connection_name);
return HANDLER_ERROR;
default:

Loading…
Cancel
Save