From: Christopher Faulet Date: Wed, 1 Mar 2023 14:45:39 +0000 (+0100) Subject: BUG/MINOR: http-ana: Don't increment conn_retries counter before the L7 retry X-Git-Tag: v2.8-dev5~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41ade746c727596d5ac6fa10446be25c19d39362;p=thirdparty%2Fhaproxy.git BUG/MINOR: http-ana: Don't increment conn_retries counter before the L7 retry When we are about to perform a L7 retry, we deal with the conn_retries counter, to be sure we can retry. However, there is an issue here because the counter is incremented before it is checked against the backend limit. So, we can miss a connection retry. Of course, we must invert both operation. The conn_retries counter must be incremented after the check agains the backend limit. This patch must be backported as far as 2.6. --- diff --git a/src/http_ana.c b/src/http_ana.c index 80263e61a3..3aebd42727 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -1118,10 +1118,9 @@ static __inline int do_l7_retry(struct stream *s, struct stconn *sc) struct channel *req, *res; int co_data; - s->conn_retries++; if (s->conn_retries >= s->be->conn_retries) return -1; - + s->conn_retries++; if (objt_server(s->target)) { if (s->flags & SF_CURR_SESS) { s->flags &= ~SF_CURR_SESS;