changeset 6154:cca856715722

Upstream: report to error_log when max_fails is reached. This can be useful to understand why "no live upstreams" happens, in particular.
author Ruslan Ermilov <ru@nginx.com>
date Wed, 20 May 2015 22:44:00 +0300
parents 4f6efabcb09b
children 193bbc006d5e
files src/http/ngx_http_upstream_round_robin.c src/stream/ngx_stream_upstream_round_robin.c
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/ngx_http_upstream_round_robin.c
+++ b/src/http/ngx_http_upstream_round_robin.c
@@ -622,6 +622,11 @@ ngx_http_upstream_free_round_robin_peer(
 
         if (peer->max_fails) {
             peer->effective_weight -= peer->weight / peer->max_fails;
+
+            if (peer->fails >= peer->max_fails) {
+                ngx_log_error(NGX_LOG_WARN, pc->log, 0,
+                              "upstream server temporarily disabled");
+            }
         }
 
         ngx_log_debug2(NGX_LOG_DEBUG_HTTP, pc->log, 0,
--- a/src/stream/ngx_stream_upstream_round_robin.c
+++ b/src/stream/ngx_stream_upstream_round_robin.c
@@ -495,6 +495,11 @@ ngx_stream_upstream_free_round_robin_pee
 
         if (peer->max_fails) {
             peer->effective_weight -= peer->weight / peer->max_fails;
+
+            if (peer->fails >= peer->max_fails) {
+                ngx_log_error(NGX_LOG_WARN, pc->log, 0,
+                              "upstream server temporarily disabled");
+            }
         }
 
         ngx_log_debug2(NGX_LOG_DEBUG_STREAM, pc->log, 0,