Hi Pieter,

On Tue, May 22, 2018 at 09:00:24PM +0200, PiBa-NL wrote:
> Hi Olivier,
> 
> Op 22-5-2018 om 18:46 schreef Olivier Houchard:
> > Hi Pieter,
> > 
> > Does the attached patch fix it for you ? It's been generated from master,
> > but will probably apply against 1.8 as well.
> > 
> > Thanks !
> > 
> > Olivier
> 
> Patch works for me (on master, didn't try with 1.8). Or at least i'm running
> the same testbox for an hour now without issue.
> Thanks !
> 

Thanks a lot for testing, and your usual investigation work !

Willy, can you please apply this ?

Thanks !

Olivier
>From b938f86e1fe51e95adc73f9e583dd225f5ecf88d Mon Sep 17 00:00:00 2001
From: Olivier Houchard <ohouch...@haproxy.com>
Date: Tue, 22 May 2018 18:40:07 +0200
Subject: [PATCH] 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.
---
 src/dns.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/dns.c b/src/dns.c
index e42950212..e2d46a658 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -348,11 +348,10 @@ 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);
+
 }
 
 
-- 
2.14.3

Reply via email to