]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: server: fix the connection release logic regarding nearly full conditions
authorWilly Tarreau <w@1wt.eu>
Wed, 1 Jul 2020 11:57:49 +0000 (13:57 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 1 Jul 2020 12:14:29 +0000 (14:14 +0200)
There was a logic bug in commit ddfe0743d ("MEDIUM: server: use the two
thresholds for the connection release algorithm"): instead of keeping
only our first idle connection when FDs become scarce, the condition was
inverted resulting in enforcing this constraint unless FDs are scarce.
This results in less idle connections than permitted to be kept under
normal condition.

No backport needed.

include/haproxy/server.h

index 1fa1b2d4dbd151e8fe176e4d1a8a7fc93132626b..6ab6c07fa86cb05fea19c1d155934624b8b4a327 100644 (file)
@@ -255,11 +255,11 @@ static inline int srv_add_to_idle_list(struct server *srv, struct connection *co
            ((srv->proxy->options & PR_O_REUSE_MASK) != PR_O_REUSE_NEVR) &&
            ha_used_fds < global.tune.pool_high_count &&
            (srv->max_idle_conns == -1 || srv->max_idle_conns > srv->curr_idle_conns) &&
-           ((ha_used_fds < global.tune.pool_low_count &&
-             MT_LIST_ISEMPTY(&srv->safe_conns[tid]) &&
+           ((MT_LIST_ISEMPTY(&srv->safe_conns[tid]) &&
              (is_safe || MT_LIST_ISEMPTY(&srv->idle_conns[tid]))) ||
-            (srv->curr_used_conns + srv->curr_idle_conns <
-             MAX(srv->curr_used_conns, srv->est_need_conns) + global.nbthread)) &&
+            (ha_used_fds < global.tune.pool_low_count &&
+             (srv->curr_used_conns + srv->curr_idle_conns <
+              MAX(srv->curr_used_conns, srv->est_need_conns) + global.nbthread))) &&
            !conn->mux->used_streams(conn) && conn->mux->avail_streams(conn)) {
                int retadd;