BUG/MINOR: srv: do not cleanup idle conns if pool max is null
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 6 Jan 2021 13:28:51 +0000 (14:28 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 6 Jan 2021 16:24:32 +0000 (17:24 +0100)
If a server is configured to not have any idle conns, returns immediatly
from srv_cleanup_connections. This avoids a segfault when a server is
configured with pool-max-conn to 0.

This should be backported up to 2.2.

(cherry picked from commit 10d5c3172b366e48b5851a20de9b68f0d5495b92)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>

src/server.c

index da1059c..79de104 100644 (file)
@@ -5221,6 +5221,10 @@ static void srv_cleanup_connections(struct server *srv)
        int did_remove;
        int i;
 
+       /* nothing to do if pool-max-conn is null */
+       if (!srv->max_idle_conns)
+               return;
+
        /* check all threads starting with ours */
        HA_SPIN_LOCK(OTHER_LOCK, &idle_conn_srv_lock);
        for (i = tid;;) {