]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream: don't wait before retrying after a failed connection reuse
authorWilly Tarreau <w@1wt.eu>
Wed, 23 Jan 2019 15:29:53 +0000 (16:29 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 24 Jan 2019 18:06:43 +0000 (19:06 +0100)
When a connection reuse fails, we must not wait before retrying, as most
likely the issue is related to the reused connection and not to the server
itself.

This should be backported to 1.9, though it depends on previous patches
dealing with SI_ST_CON for connection reuse.

src/stream.c

index c0f4b070c1ec5cdb6c9b7c57701fe5b148658e7c..b66322752afba5c2bebd12b89fe8979a95244f46 100644 (file)
@@ -798,7 +798,9 @@ static int sess_update_st_cer(struct stream *s)
                /* The error was an asynchronous connection error, and we will
                 * likely have to retry connecting to the same server, most
                 * likely leading to the same result. To avoid this, we wait
-                * MIN(one second, connect timeout) before retrying.
+                * MIN(one second, connect timeout) before retrying. We don't
+                * do it when the failure happened on a reused connection
+                * though.
                 */
 
                int delay = 1000;
@@ -810,9 +812,9 @@ static int sess_update_st_cer(struct stream *s)
                        si->err_type = SI_ET_CONN_ERR;
 
                /* only wait when we're retrying on the same server */
-               if (si->state == SI_ST_ASS ||
-                   (s->be->lbprm.algo & BE_LB_KIND) != BE_LB_KIND_RR ||
-                   (s->be->srv_act <= 1)) {
+               if ((si->state == SI_ST_ASS ||
+                    (s->be->lbprm.algo & BE_LB_KIND) != BE_LB_KIND_RR ||
+                    (s->be->srv_act <= 1)) && !(s->flags & SF_SRV_REUSED)) {
                        si->state = SI_ST_TAR;
                        si->exp = tick_add(now_ms, MS_TO_TICKS(delay));
                }