]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: server: Be really able to keep "pool-max-conn" idle connections
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 10 Jul 2019 12:06:33 +0000 (14:06 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 10 Jul 2019 12:20:52 +0000 (14:20 +0200)
The maximum number of idle connections for a server can be configured by setting
the server option "pool-max-conn". But when we try to add a connection in its
idle list, because of a wrong comparison, it may be rejected because there are
already "pool-max-conn - 1" idle connections.

This patch must be backported to 2.0 and 1.9.

include/proto/server.h

index d0b925c5692ac42c6c5e1bb002c330ca8603ee18..10c55a94e5672b1e92402e28130dae061b1c20da 100644 (file)
@@ -256,7 +256,7 @@ static inline int srv_add_to_idle_list(struct server *srv, struct connection *co
                int retadd;
 
                retadd = _HA_ATOMIC_ADD(&srv->curr_idle_conns, 1);
-               if (retadd >= srv->max_idle_conns) {
+               if (retadd > srv->max_idle_conns) {
                        _HA_ATOMIC_SUB(&srv->curr_idle_conns, 1);
                        return 0;
                }