]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: dns: release the session slot of expired TCP queries master
authorOlivier Houchard <ohouchard@haproxy.com>
Tue, 17 Nov 2026 16:20:57 +0000 (17:20 +0100)
committerOlivier Houchard <cognet@ci0.org>
Tue, 17 Nov 2026 17:18:26 +0000 (18:18 +0100)
commitf16798587eea24aa413a582431f613f5f93c59de
tree211d75d17a4cb16f576f8c06aa1f38039a111c90
parent83b5d711a4766112206802df1bcc3f9f958b340a
BUG/MEDIUM: dns: release the session slot of expired TCP queries

A DNS-over-TCP session counts its pipelined queries in ds->nb_queries, up
to DNS_STREAM_MAX_PIPELINED_REQ (4), and only dns_recv_nameserver()
releases a slot, when a response is delivered. But when a query expires
without response, dns_process_query_exp() only decrements onfly_queries.
After 4 unanswered queries, the session is thus neither in the free nor in
the idle list anymore: it is never reused nor released and its connection
remains open forever, while new queries open new connections. With a TCP
nameserver not answering some names, one connection is leaked every 4
such queries, without limit.

Let's release the slot when a query expires, and move the session to the
free or idle list, under the stream server's lock, exactly as done when a
response is received.

This was introduced in 2.4 with commit fd647d5f5 ("MEDIUM: dns: adds code
to support pipelined DNS requests over TCP."), so this must be backported
to all stable branches.
src/dns.c