From: Christopher Faulet Date: Wed, 9 Dec 2020 18:46:38 +0000 (+0100) Subject: BUG/MINOR: tcpcheck: Don't rearm the check timeout on each read X-Git-Tag: v2.3.3~40 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=cc554538e97102e51649167503eae093dd5c5998;p=haproxy-2.3.git BUG/MINOR: tcpcheck: Don't rearm the check timeout on each read The check timeout is used to limit a health-check execution. By default inter timeout is used. But when defined the check timeout is used. In this case, the inter timeout (or connect timeout) is used for the connection establishment only. And the check timeout for the health-check execution. Thus, it must be set after a successfull connect. It means it is rearm at the end of each connect rule. This patch with the previous one (BUG/MINOR: http-check: Use right condition to consider HTX message as full) should solve the issue #991. It must be backported as far as 2.2. On the 2.3 and 2.2, there are 2 places were the connection establishement is handled. The check timeout must be set on both. (cherry picked from commit c878f56f7c921135acca5e3dccf7961422928285) Signed-off-by: Christopher Faulet --- diff --git a/src/tcpcheck.c b/src/tcpcheck.c index 55b213b..eed935c 100644 --- a/src/tcpcheck.c +++ b/src/tcpcheck.c @@ -1210,6 +1210,10 @@ enum tcpcheck_eval_ret tcpcheck_eval_connect(struct check *check, struct tcpchec out: if (conn && check->result == CHK_RES_FAILED) conn->flags |= CO_FL_ERROR; + + if (ret == TCPCHK_EVAL_CONTINUE && check->proxy->timeout.check) + check->task->expire = tick_add_ifset(now_ms, check->proxy->timeout.check); + return ret; } @@ -1995,6 +1999,10 @@ int tcpcheck_main(struct check *check) must_read = 0; } } + + if (check->proxy->timeout.check) + check->task->expire = tick_add_ifset(now_ms, check->proxy->timeout.check); + rule = LIST_NEXT(&check->current_step->list, typeof(rule), list); } @@ -2057,9 +2065,6 @@ int tcpcheck_main(struct check *check) case TCPCHK_ACT_EXPECT: check->current_step = rule; if (must_read) { - if (check->proxy->timeout.check) - check->task->expire = tick_add_ifset(now_ms, check->proxy->timeout.check); - eval_ret = tcpcheck_eval_recv(check, rule); if (eval_ret == TCPCHK_EVAL_STOP) goto out_end_tcpcheck;