]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: backend: Don't increment conn_retries counter too early
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 3 Aug 2022 08:47:48 +0000 (10:47 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 3 Aug 2022 09:16:35 +0000 (11:16 +0200)
The connection retry counter is incremented too early when a connection
fails. In SC_ST_CER state, errors handling must be performed before
incrementing the counter. Otherwise, we may consider the max connection
attempt is reached while a last one is in fact possible.

This patch must be backported to 2.6.

src/backend.c

index 2ae76002b163b541457a860003fa61cd2523f863..672604601ba43c23462caf9c0e114a9d9a6585d0 100644 (file)
@@ -2293,8 +2293,6 @@ void back_handle_st_cer(struct stream *s)
        s->conn_exp = TICK_ETERNITY;
        s->flags &= ~SF_CONN_EXP;
 
-       s->conn_retries++;
-
        /* we probably have to release last stream from the server */
        if (objt_server(s->target)) {
                struct connection *conn = sc_conn(sc);
@@ -2389,6 +2387,7 @@ void back_handle_st_cer(struct stream *s)
                goto end;
        }
 
+       s->conn_retries++;
        stream_choose_redispatch(s);
 
        if (must_tar) {