From 9adccb3e767d61623f0d80bae431a2424e54f0d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Thu, 24 Sep 2015 13:56:22 +0200 Subject: [PATCH] Protocols.DNS: Reduce race-condition window in do_query(). When executing do_query() in another thread than the backend thread, there was a risk that the answer would be received and handled by the backend thread before the retry call_out was installed. This could cause do_query() to fail with "Lookup in destructed object." Potential fix for [bug 7460]. --- lib/modules/Protocols.pmod/DNS.pmod | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/modules/Protocols.pmod/DNS.pmod b/lib/modules/Protocols.pmod/DNS.pmod index b1e04dba50..d2d656bc88 100644 --- a/lib/modules/Protocols.pmod/DNS.pmod +++ b/lib/modules/Protocols.pmod/DNS.pmod @@ -1913,8 +1913,8 @@ class async_client } } - send(nameservers[nsno],53,r->req); r->retry_co = call_out(retry, RETRY_DELAY, r, nsno+1); + udp::send(nameservers[nsno], 53, r->req); } //! Enqueue a new raw DNS request. @@ -1936,9 +1936,9 @@ class async_client string req=low_mkquery(lid,domain,cl,type); object r = Request(domain, req, callback, args); - requests[lid]=r; - udp::send(nameservers[0],53,r->req); r->retry_co = call_out(retry, RETRY_DELAY, r, 1); + requests[lid] = r; + udp::send(nameservers[0], 53, req); return r; } } -- GitLab