From: Christopher Faulet Date: Tue, 11 Apr 2023 05:44:34 +0000 (+0200) Subject: BUG/MEDIUM: dns: Kill idle DNS sessions during stopping stage X-Git-Tag: v2.8-dev8~194 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0f4717727548e2f2dc0e1033b4043ad41827547;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/dns.c b/src/dns.c index a0fdcadfe0..a48eadd620 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 */