From: Christopher Faulet Date: Tue, 11 Apr 2023 05:58:27 +0000 (+0200) Subject: BUG/MINOR: resolvers: Wakeup DNS idle task on stopping X-Git-Tag: v2.8-dev8~193 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=142cc1b52a01d2aac30c91a4abb74b0a6aaca705;p=thirdparty%2Fhaproxy.git BUG/MINOR: resolvers: Wakeup DNS idle task on stopping Thanks to previous commit ("BUG/MEDIUM: dns: Kill idle DNS sessions during stopping stage"), DNS idle sessions are killed on stopping staged. But the task responsible to kill these sessions is running every 5 seconds. It means, when HAProxy is stopped, we can observe a delay before the process exits. To reduce this delay, when the resolvers task is executed, all DNS idle tasks are woken up. This patch must be backported as far as 2.6. --- diff --git a/src/resolvers.c b/src/resolvers.c index 0b78fafb8b..632d906113 100644 --- a/src/resolvers.c +++ b/src/resolvers.c @@ -2451,9 +2451,19 @@ struct task *process_resolvers(struct task *t, void *context, unsigned int state LIST_APPEND(&resolvers->resolutions.wait, &res->list); } } + resolv_update_resolvers_timeout(resolvers); HA_SPIN_UNLOCK(DNS_LOCK, &resolvers->lock); + if (unlikely(stopping)) { + struct dns_nameserver *ns; + + list_for_each_entry(ns, &resolvers->nameservers, list) { + if (ns->stream) + task_wakeup(ns->stream->task_idle, TASK_WOKEN_MSG); + } + } + /* now we can purge all queued deletions */ leave_resolver_code(); return t;