diff options
author | Stefan Bühler <stbuehler@web.de> | 2009-10-11 19:08:38 +0000 |
---|---|---|
committer | Stefan Bühler <stbuehler@web.de> | 2009-10-11 19:08:38 +0000 |
commit | b9db35f5ff3b92db433ec15f433416f7b4099f48 (patch) | |
tree | 74322a02426302659bc7662742624ebc36db676e | |
parent | 17d0c36eed57e7a3b1c1cbf3da7ae5dc158edbde (diff) | |
download | lighttpd-git-b9db35f5ff3b92db433ec15f433416f7b4099f48.tar.gz |
mod_fastcgi: don't disable backend if disable-time is 0 (fixes #1825)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2632 152afb58-edef-0310-8abb-c4023f1b3aa9
-rw-r--r-- | src/mod_fastcgi.c | 63 |
1 files changed, 27 insertions, 36 deletions
diff --git a/src/mod_fastcgi.c b/src/mod_fastcgi.c index a9d413fb..059b27c0 100644 --- a/src/mod_fastcgi.c +++ b/src/mod_fastcgi.c @@ -2768,16 +2768,7 @@ static handler_t fcgi_write_request(server *srv, handler_ctx *hctx) { return HANDLER_ERROR; } if ((!host->port && !host->unixsocket->used)) { - log_error_write(srv, __FILE__, __LINE__, "sxddd", - "write-req: error", - host, - host->host->used, - host->port, - host->unixsocket->used); - - hctx->proc->disabled_until = srv->cur_ts + hctx->host->disable_time; - hctx->proc->state = PROC_STATE_DIED; - + log_error_write(srv, __FILE__, __LINE__, "s", "fatal error: neither host->port nor host->unixsocket is set"); return HANDLER_ERROR; } @@ -2791,8 +2782,10 @@ static handler_t fcgi_write_request(server *srv, handler_ctx *hctx) { log_error_write(srv, __FILE__, __LINE__, "ss", "getsockopt failed:", strerror(errno)); - hctx->proc->disabled_until = srv->cur_ts + hctx->host->disable_time; - hctx->proc->state = PROC_STATE_DIED; + if (hctx->host->disable_time) { + hctx->proc->disabled_until = srv->cur_ts + hctx->host->disable_time; + hctx->proc->state = PROC_STATE_DIED; + } return HANDLER_ERROR; } @@ -2805,16 +2798,11 @@ static handler_t fcgi_write_request(server *srv, handler_ctx *hctx) { "socket:", hctx->proc->connection_name); } - hctx->proc->disabled_until = srv->cur_ts + hctx->host->disable_time; - - if (hctx->proc->is_local) { - hctx->proc->state = PROC_STATE_DIED_WAIT_FOR_PID; - } else { + if (hctx->host->disable_time) { + hctx->proc->disabled_until = srv->cur_ts + hctx->host->disable_time; hctx->proc->state = PROC_STATE_DIED; } - hctx->proc->state = PROC_STATE_DIED; - fastcgi_status_copy_procname(p->statuskey, hctx->host, hctx->proc); buffer_append_string_len(p->statuskey, CONST_STR_LEN(".died")); @@ -2898,14 +2886,15 @@ static handler_t fcgi_write_request(server *srv, handler_ctx *hctx) { /* cool down the backend, it is overloaded * -> EAGAIN */ - log_error_write(srv, __FILE__, __LINE__, "sdssdsd", - "backend is overloaded; we'll disable it for", hctx->host->disable_time, "seconds and send the request to another backend instead:", - "reconnects:", hctx->reconnects, - "load:", host->load); - + if (hctx->host->disable_time) { + log_error_write(srv, __FILE__, __LINE__, "sdssdsd", + "backend is overloaded; we'll disable it for", hctx->host->disable_time, "seconds and send the request to another backend instead:", + "reconnects:", hctx->reconnects, + "load:", host->load); - hctx->proc->disabled_until = srv->cur_ts + hctx->host->disable_time; - hctx->proc->state = PROC_STATE_OVERLOADED; + hctx->proc->disabled_until = srv->cur_ts + hctx->host->disable_time; + hctx->proc->state = PROC_STATE_OVERLOADED; + } fastcgi_status_copy_procname(p->statuskey, hctx->host, hctx->proc); buffer_append_string_len(p->statuskey, CONST_STR_LEN(".overloaded")); @@ -2921,17 +2910,19 @@ static handler_t fcgi_write_request(server *srv, handler_ctx *hctx) { * for check if the host is back in hctx->host->disable_time seconds * */ - hctx->proc->disabled_until = srv->cur_ts + hctx->host->disable_time; - if (hctx->proc->is_local) { - hctx->proc->state = PROC_STATE_DIED_WAIT_FOR_PID; - } else { - hctx->proc->state = PROC_STATE_DIED; - } + if (hctx->host->disable_time) { + hctx->proc->disabled_until = srv->cur_ts + hctx->host->disable_time; + if (hctx->proc->is_local) { + hctx->proc->state = PROC_STATE_DIED_WAIT_FOR_PID; + } else { + hctx->proc->state = PROC_STATE_DIED; + } - log_error_write(srv, __FILE__, __LINE__, "sdssdsd", - "backend died; we'll disable it for", hctx->host->disable_time, "seconds and send the request to another backend instead:", - "reconnects:", hctx->reconnects, - "load:", host->load); + log_error_write(srv, __FILE__, __LINE__, "sdssdsd", + "backend died; we'll disable it for", hctx->host->disable_time, "seconds and send the request to another backend instead:", + "reconnects:", hctx->reconnects, + "load:", host->load); + } fastcgi_status_copy_procname(p->statuskey, hctx->host, hctx->proc); buffer_append_string_len(p->statuskey, CONST_STR_LEN(".died")); |