From 42abe68f111fac0849e4c811de5ef8e772efeb17 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 2 Jul 2020 15:19:57 +0200 Subject: [PATCH] BUG/MEDIUM: cli/proxy: don't try to dump idle connection state if there's none Commit 69f591e3b ("MINOR: cli/proxy: add a new "show servers conn" command") added the ability to dump the idle connections state for a server, but we must not do this if idle connections were not allocated, which happens if the server is configured with pool-max-conn 0. This is 2.2, no backport is needed. --- src/proxy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/proxy.c b/src/proxy.c index 93c46651c..a47509542 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -1823,7 +1823,7 @@ static int dump_servers_state(struct stream_interface *si) srv->curr_used_conns, srv->max_used_conns, srv->est_need_conns, srv->curr_idle_nb, srv->curr_safe_nb, (int)srv->max_idle_conns, srv->curr_idle_conns); - for (thr = 0; thr < global.nbthread; thr++) + for (thr = 0; thr < global.nbthread && srv->curr_idle_thr; thr++) chunk_appendf(&trash, " %u", srv->curr_idle_thr[thr]); chunk_appendf(&trash, "\n");