BUG/MINOR: server: fix the connection release logic regarding nearly full conditions

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.
This commit is contained in:
Willy Tarreau 2020-07-01 13:57:49 +02:00
parent 151c253a1e
commit 35e30c9670

View 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;