From: Nick M. <ni...@us...> - 2009-11-27 22:37:53
|
Author: Zhuang Yuyao <ml...@gm...> Date: Fri, 27 Nov 2009 16:02:49 -0500 Subject: Fix an evdns lock violation. Commit: 2df1f82bfa1b432a277b0e1f8fc65aed7898f5e5 Original message: evdns contains a bug related to thread lock. enable thread lock by evthread_use_pthreads() will cause successive evdns_base_resolve_ipv4() (and other resolve functions i think) to hang on EVDNS_LOCK(base) after one or several successful call to evdns_base_resolve_ipv4(). --- evdns.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/evdns.c b/evdns.c index 097dae1..1a59170 100644 --- a/evdns.c +++ b/evdns.c @@ -616,8 +616,9 @@ nameserver_failed(struct nameserver *const ns, const char *msg) { } static void -nameserver_up(struct nameserver *const ns) { - EVDNS_LOCK(ns->base); +nameserver_up(struct nameserver *const ns) +{ + ASSERT_LOCKED(ns->base); if (ns->state) return; log(EVDNS_LOG_WARN, "Nameserver %s is back up", debug_ntop((struct sockaddr *)&ns->address)); @@ -3895,6 +3896,7 @@ evdns_getaddrinfo_timeout_cb(evutil_socket_t fd, short what, void *ptr) v4_timedout = 1; EVDNS_LOCK(data->evdns_base); ++data->evdns_base->getaddrinfo_ipv4_timeouts; + EVDNS_UNLOCK(data->evdns_base); } if (data->ipv6_request.r) { evdns_cancel_request(NULL, data->ipv6_request.r); -- 1.6.3 |