]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: checks: only trigger a DNS resolution with the resolvers lock
authorOlivier Houchard <ohouchard@haproxy.com>
Wed, 18 Nov 2026 13:06:45 +0000 (14:06 +0100)
committerOlivier Houchard <cognet@ci0.org>
Wed, 18 Nov 2026 13:08:54 +0000 (14:08 +0100)
commit973c07763ef5f0c7d50b7c77fb9bcfefbc1ef997
treecfde7461ed42a09545334a2048337675ecd83dda
parent586d0eef7da496cdb4f0658fbdda6c54af831979
BUG/MINOR: checks: only trigger a DNS resolution with the resolvers lock

When a health check fails to establish its L4 connection, the check code
calls resolv_trigger_resolution() on the server's requester to force a
new resolution. This function reads the resolution's status, step and
last_resolution, and writes last_resolution, while these fields are
otherwise only accessed under the resolvers' lock, possibly from another
thread processing a response. At worst a resolution is triggered again
too early, causing an extra DNS query. The resolution itself cannot be
freed in the meantime since the check holds the server's lock, which the
unlinking paths take before releasing the resolution.

The resolvers take the server's lock under their own lock, so we cannot
wait for the resolvers' lock here. The trigger being opportunistic, let's
just try to take it and skip the trigger when it is busy.

No backport is needed.
src/check.c