From e0f4717727548e2f2dc0e1033b4043ad41827547 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Tue, 11 Apr 2023 07:44:34 +0200 Subject: [PATCH] BUG/MEDIUM: dns: Kill idle DNS sessions during stopping stage There is no server timeout for DNS sessions over TCP. It means idle session cannot be killed by itself. There is a task running peridically, every 5s, to kill the excess of idle sessions. But the last one is never killed. During the stopping stage, it is an issue since the dynamic resolutions are no longer performed (2ec6f14c "BUG/MEDIUM: resolvers: Properly stop server resolutions on soft-stop"). Before the above commit, during stopping stage, the DNS sessions were killed when a resolution was triggered. Now, nothing kills these sessions. This prevents the process to finish on soft-stop. To fix this bug, the task killing excess of idle sessions now kill all idle sessions on stopping stage. This patch must be backported as far as 2.6. --- src/dns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dns.c b/src/dns.c index a0fdcadfe..a48eadd62 100644 --- a/src/dns.c +++ b/src/dns.c @@ -1005,7 +1005,7 @@ static struct task *dns_process_idle_exp(struct task *t, void *context, unsigned target = (dss->max_active_conns - cur_active_conns) / 2; list_for_each_entry_safe(ds, dsb, &dss->idle_sess, list) { - if (!target) + if (!stopping && !target) break; /* remove conn to pending list to ensure it won't be reused */