host-resolver: Do not cancel threads waiting for new queries during cleanup
authorMartin Willi <martin@revosec.ch>
Tue, 24 Feb 2015 15:00:38 +0000 (16:00 +0100)
committerMartin Willi <martin@revosec.ch>
Tue, 24 Feb 2015 15:00:38 +0000 (16:00 +0100)
commitd0d85683563e9f296e47e1c1859f49065ca49890
tree970d1d1db94963e3cb9798875f59930597bfdae0
parent2113f482712b441ba4516cbad26d328a5be15d28
host-resolver: Do not cancel threads waiting for new queries during cleanup

While it is currently unclear why it happens, canceling threads waiting in the
new_query condvar does not work as expected. The behavior is not fully
reproducible: Either cancel(), join() or destroying the condvar hangs.

The issue has been seen in the http-fetcher unit tests, where the stream service
triggers the use of the resolver for "localhost" hosts. It is reproducible with
any cleanup following a host_create_from_dns() use on a Ubuntu 14.04 x64 system.
Further, the issue is related to the use of libunwind, as only builds with
--enable-unwind-backtraces are affected.

As we broadcast() the new_query condvar before destruction, a hard cancel() of
these threads is actually not required. Instead we let these threads clean up
themselves after receiving the condvar signal.
src/libstrongswan/networking/host_resolver.c