]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: server: always count one idle slot for current thread
authorWilly Tarreau <w@1wt.eu>
Mon, 29 Jun 2020 18:37:29 +0000 (20:37 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 29 Jun 2020 19:54:38 +0000 (21:54 +0200)
The idle server connection estimates brought in commit bdb86bd ("MEDIUM:
server: improve estimate of the need for idle connections") were committed
without the minimum of 1 idle conn needed for the current thread. The net
effect is that there are bursts of dropped connections when the load varies
because there's no provision for the last connection.

No backport needed, this is 2.2-dev.

include/haproxy/server.h

index 4d025ade426686a9baf7906401d11db81e3affde..75a5b27f3a4a0d823ff639aa691bdb9f48e49b8f 100644 (file)
@@ -253,7 +253,7 @@ static inline int srv_add_to_idle_list(struct server *srv, struct connection *co
        if (srv && srv->pool_purge_delay > 0 &&
            (srv->max_idle_conns == -1 || srv->max_idle_conns > srv->curr_idle_conns) &&
            (srv->curr_used_conns + srv->curr_idle_conns < MAX(srv->curr_used_conns, srv->est_need_conns) +
-            (MT_LIST_ISEMPTY(&srv->safe_conns[tid]) && MT_LIST_ISEMPTY(&srv->idle_conns[tid])) ? global.nbthread : 0) &&
+            (MT_LIST_ISEMPTY(&srv->safe_conns[tid]) && MT_LIST_ISEMPTY(&srv->idle_conns[tid])) ? global.nbthread : 1) &&
            !(conn->flags & CO_FL_PRIVATE) &&
            ((srv->proxy->options & PR_O_REUSE_MASK) != PR_O_REUSE_NEVR) &&
            !conn->mux->used_streams(conn) && conn->mux->avail_streams(conn) &&