From: Willy Tarreau Date: Wed, 23 Jan 2019 15:29:53 +0000 (+0100) Subject: MINOR: stream: don't wait before retrying after a failed connection reuse X-Git-Tag: v2.0-dev1~156 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f7a259d46f84ade7222debbce937d5d94bc568f4;p=thirdparty%2Fhaproxy.git MINOR: stream: don't wait before retrying after a failed connection reuse 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. --- diff --git a/src/stream.c b/src/stream.c index c0f4b070c1..b66322752a 100644 --- a/src/stream.c +++ b/src/stream.c @@ -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)); }