Browse Source

[mod_scgi] do not reconnect after connect succeeds

apply diff from commit:2eaf42d0 made to mod_fastcgi.c back in 2009

(change is being made for (a bit more) consistency between the modules
 as mod_scgi.c was forked from mod_fastcgi.c a very long time ago, as
 well as to remove call to sleep for 10ms (usleep(10000) from mod_scgi)

x-ref:
  "fastcgi incomplete header might crash lighty"
  https://redmine.lighttpd.net/issues/2096
personal/stbuehler/mod-csrf
Glenn Strauss 5 years ago
parent
commit
1804ccbd6d
  1. 25
      src/mod_scgi.c

25
src/mod_scgi.c

@ -2003,30 +2003,13 @@ static handler_t scgi_write_request(server *srv, handler_ctx *hctx) {
if (ret < 0) {
if (errno == ENOTCONN || ret == -2) {
/* 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 let the php a chance to restart
*/
return scgi_reconnect(srv, hctx);
}
/* 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",
"connection was dropped after accept(). reconnect() denied:",
log_error_write(srv, __FILE__, __LINE__, "ssosdb",
"connection was dropped after accept() (perhaps the scgi process died),",
"write-offset:", hctx->wb->bytes_out,
"reconnect attempts:", hctx->reconnects);
"socket:", hctx->proc->port, hctx->proc->socket);
return HANDLER_ERROR;
} else {

Loading…
Cancel
Save