BUG/MAJOR: dns: Make the do-resolve action thread-safe
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 22 Jul 2020 09:46:32 +0000 (11:46 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 23 Jul 2020 14:10:34 +0000 (16:10 +0200)
commit6e5861d72fe1e3c9d34b591d6f77ffd28ddde197
treec0f30131f6b13a428c59592f28aff803e0c4a83f
parent9fd9128f1554fd42a7b27e5a4e65afa92e67c05f
BUG/MAJOR: dns: Make the do-resolve action thread-safe

The do-resolve HTTP action, performing a DNS resolution of a sample expression
output, is not thread-safe at all. The resolver object used to do the resolution
must be locked when the action is executed or when the stream is released
because its curr or wait resolution lists and the requester list inside a
resolution are updated. It is also important to not wake up a released stream
(with a destroyed task).

Of course, because of this bug, various kind of crashes may be observed.

This patch should fix the issue #236. It must be backported as far as 2.0.

(cherry picked from commit 5098a08c2fafb0d9513996729d2a30c9785378f3)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 99f4623952cbbad2bcae451abdd0f3133bcbe75c)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/dns.c
src/stream.c