From b26881a5d52c8e4abd61a8305c24baf3df990d59 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sat, 23 Dec 2017 11:16:49 +0100 Subject: [PATCH] BUG/MEDIUM: checks: properly set servers to stopping state on 404 Paul Lockaby reported that since 1.8, disable-on-404 doesn't work anymore in that the server stay up despite returning 404. Cyril spotted that this was caused by a copy-paste error introduced by commit 5a13351 ("BUG/MEDIUM: log: check result details truncated.") causing set_server_running() to be called instead of set_server_stopping() in this case. It can be reproduced with the simple test config below : defaults mode http timeout connect 1s timeout client 10s timeout server 10s listen http bind :8888 option httpchk GET / http-check disable-on-404 server s1 127.0.0.1:9001 check server s2 127.0.0.1:9002 check http-response add-header x-served-by %s listen s1 bind :9001 server next 127.0.0.1:9002 http-response set-status 404 frontend s2 bind :9002 http-request redirect location / S1 is supposed to be stopping and s2 up, which is not the case. After calling the correct function, only S2 is used now. This needs to be backported to 1.8. --- src/checks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/checks.c b/src/checks.c index 3a6f02038..56c9d609d 100644 --- a/src/checks.c +++ b/src/checks.c @@ -376,7 +376,7 @@ static void check_notify_stopping(struct check *check) if ((s->agent.state & CHK_ST_ENABLED) && (s->agent.health < s->agent.rise)) return; - srv_set_running(s, NULL, (!s->track && !(s->proxy->options2 & PR_O2_LOGHCHKS)) ? check : NULL); + srv_set_stopping(s, NULL, (!s->track && !(s->proxy->options2 & PR_O2_LOGHCHKS)) ? check : NULL); } /* note: use health_adjust() only, which first checks that the observe mode is