BUG/MEDIUM: dns: Delay the attempt to run a DNS resolution on check failure.

When checks fail, the code tries to run a dns resolution, in case the IP
changed.
The old way of doing that was to check, in case the last dns resolution
hadn't expired yet, if there were an applicable IP, which should be useless,
because it has already be done when the resolution was first done, or to
run a new resolution.
Both are a locking nightmare, and lead to deadlocks, so instead, just wake the
resolvers task, that should do the trick.

This should be backported to 1.8.
This commit is contained in:
Olivier Houchard 2018-05-22 18:40:07 +02:00 committed by Willy Tarreau
parent 926594f606
commit f3d9e608d7

View File

@ -348,11 +348,9 @@ void dns_trigger_resolution(struct dns_requester *req)
/* The resolution must not be triggered yet. Use the cached response, if
* valid */
exp = tick_add(res->last_resolution, resolvers->hold.valid);
if (res->status == RSLV_STATUS_VALID &&
tick_isset(res->last_resolution) && !tick_is_expired(exp, now_ms))
req->requester_cb(req, NULL);
else
dns_run_resolution(res);
if (resolvers->t && (res->status != RSLV_STATUS_VALID ||
!tick_isset(res->last_resolution) || tick_is_expired(exp, now_ms)))
task_wakeup(resolvers->t, TASK_WOKEN_OTHER);
}