From: Manu Nicolas Date: Tue, 18 Aug 2026 17:24:47 +0000 (+0000) Subject: BUG/MINOR: dns: schedule idle task after setting its thread X-Git-Tag: v3.5-dev5~8 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=70e4074434e8f8687e2671cff2d5b1355c3f812d;p=haproxy.git BUG/MINOR: dns: schedule idle task after setting its thread Commit b8a311f49 ("MEDIUM: dns: Stick the TCP nameserver tasks to the resolvers' thread") assigns each stream nameserver task to the resolver thread during configuration finalization. However, dns_stream_init() has already queued the idle task by then. task_set_thread() removes the task from its old wait queue and queues it again after changing its owner. The current thread still belongs to the old owner, which violates wait-queue ownership. Strict builds hit the task->tid assertion while finalizing a configuration containing a TCP nameserver. Leave the idle task unqueued during stream initialization. Once finalization has set all three stream task affinities, wake the idle task so it schedules its expiration on the resolver thread. No backport is needed. The offending commit is only present in the development branch. --- diff --git a/src/dns.c b/src/dns.c index 83e0e7821..50f6e8ae0 100644 --- a/src/dns.c +++ b/src/dns.c @@ -1399,9 +1399,6 @@ int dns_stream_init(struct dns_nameserver *ns, struct server *srv) dss->task_idle->context = dss; dss->task_idle->expire = tick_add(now_ms, 5000); - /* let start the task to free idle conns immediately */ - task_queue(dss->task_idle); - LIST_INIT(&dss->free_sess); LIST_INIT(&dss->idle_sess); LIST_INIT(&dss->wait_sess); diff --git a/src/resolvers.c b/src/resolvers.c index b6da43d88..65612ab92 100644 --- a/src/resolvers.c +++ b/src/resolvers.c @@ -2827,6 +2827,7 @@ static int resolvers_finalize_config(void) task_set_thread(ns->stream->task_req, t->tid); task_set_thread(ns->stream->task_rsp, t->tid); task_set_thread(ns->stream->task_idle, t->tid); + task_wakeup(ns->stream->task_idle, TASK_WOKEN_INIT); } } task_wakeup(t, TASK_WOKEN_INIT);