]> granicus.if.org Git - libevent/commit
Fix an error for debug locking in dns/getaddrinfo_race_gotresolve
authorAzat Khuzhin <a3at.mail@gmail.com>
Sat, 20 Oct 2018 23:50:04 +0000 (02:50 +0300)
committerAzat Khuzhin <a3at.mail@gmail.com>
Sun, 21 Oct 2018 00:10:12 +0000 (03:10 +0300)
commit09c74f71217bb6c614b8597041aacf830160f3a0
tree61f390a89d2be9424b0124c7dc6025fadbdd7cb0
parent95918754d2ba7e6bffe0fc74bebed60bd917c10c
Fix an error for debug locking in dns/getaddrinfo_race_gotresolve

When there is no /etc/services file evdns_getaddrinfo() will fail (with
service="ssh") and hence it will go to then "end" label with locked
rp.lock which in case of debug locking checks will bail with:
  [err] ../evthread.c:220: Assertion lock->count == 0 failed in debug_lock_free

So add rp.locked flag, and unlock the lock before freeing it if it is in
locked state.

And here is how you can reproduce the issue:
  $ docker run -e LD_LIBRARY_PATH=$PWD/lib -e PATH=/usr/bin:/bin:$PWD/bin -v $PWD:$PWD --rm -it debian:testing regress dns/getaddrinfo_race_gotresolve
(since debian:testing does not have /etc/services)
test/regress_dns.c