Project

General

Profile

Bug #2534

Updated by Junxiao Shi over 8 years ago

This is not an issue or feature, rather a report for `util::dns::asyncResolve` (= `boost::asio::basic_resolver`) "feature".    Specifically, the timeouts that one can specify inside asyncResolve call are effective, but the asynchronous operation may not be finished after the timeout is fired and if `io_service` is still running, may fire at some point later (even with success, which may cause segfaults in some cases...). 

 The documentation for `basic_resolver` says that it has `cancel` method that will cancel all pending async operations and we use this method inside the timeout event.    However, this cancel does not work as we intended it to work (I actually, have no idea whether it does anything at all).    In 2012 3 years ago there was a related ticket with boost.asio [6138](https://svn.boost.org/trac/boost/ticket/6138), (https://svn.boost.org/trac/boost/ticket/6138), which authors of asio considered not a bug but feature. 

 The impact of this "problem" should not be great, it is just applications needs to be aware that in order to abort `io_service::run()` when asynchronous resolution times out, it is necessary to explicitly call `io_service::stop()`.

Back