BUG/MINOR: dns: wrong resolution interval lead to 100% CPU
authorBaptiste Assmann <bassmann@haproxy.com>
Mon, 21 Aug 2017 11:21:48 +0000 (13:21 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 22 Aug 2017 09:40:00 +0000 (11:40 +0200)
commitf5f71304b009f6f00fdd521a10295a5314d2ffa4
tree52c21f50fbe2c966292f7e871d0f350275d8f400
parent8d112362343dfc7848b3838fe070358b38002afa
BUG/MINOR: dns: wrong resolution interval lead to 100% CPU

Since the DNS layer split and the use of obj_type structure, we did not
updated propoerly the code used to compute the interval between 2
resolutions.
A nasty loop was then created when:
- resolver's hold.valid is shorter than servers' check.inter
- a valid response is available in the DNS cache

A task was woken up for a server's resolution. The servers pick up the IP
in the cache and returns without updating the 'last update' timestamp of
the resolution (which is normal...). Then the task is woken up again for
the same server.
The fix simply computes now properly the interval between 2 resolutions
and the cache is used properly while a new resolution is triggered if
the data is not fresh enough.
src/dns.c