]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: dns: add tempo between 2 connection attempts for dns servers
authorAurelien DARRAGON <adarragon@haproxy.com>
Tue, 29 Apr 2025 18:13:00 +0000 (20:13 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Tue, 29 Apr 2025 19:20:11 +0000 (21:20 +0200)
commit27236f2218e57d839197e5b6479dc8e67e484e32
treeb0e0366ade63eb3f67e8605e8a817ee57006bf18
parent1ced5ef2fdf9a4b4ab0941849be0f4627066331f
BUG/MINOR: dns: add tempo between 2 connection attempts for dns servers

As reported by Lukas Tribus on the mailing list [1], trying to connect to
a nameserver with invalid network settings causes haproxy to retry a new
connection attempt immediately which eventually causes unexpected CPU usage
on the thread responsible for the applet (namely 100% on one CPU will be
observed).

This can be reproduced with the test config below:

 resolvers default
  nameserver ns1 tcp4@8.8.8.8:53 source 192.168.99.99
 listen listen
  mode http
  bind :8080
  server s1 www.google.com resolvers default init-addr none

To fix this the issue, we add a temporisation of one second between a new
connection attempt is retried. We do this in dns_session_create() when we
know that the applet was created in the release callback (when previous
query attempt was unsuccessful), which means initial connection is not
affected.

[1]: https://www.mail-archive.com/haproxy@formilux.org/msg45665.html

This should fix GH #2909 and may be backported to all stable versions.
This patch depends on ("MINOR: applet: add appctx_schedule() macro")
src/dns.c