cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Threaded resolver still blocked in Curl_resolver_cancel?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 29 Apr 2012 19:11:02 +0200 (CEST)

On Fri, 27 Apr 2012, Mac Wang wrote:

> I am working on Android and have successfully built libcurl 7.25.0 with
> threaded resolver support. I learnt through reading the source code that it
> seems to only work with the multi interface

That is not true. I would expect us to have gotten (many more) bug reports if
it just didn't work with the easy interface.

> In my test, I intentionally set DNS server to some stranger IP so DNS would
> never work. I actually got timeout error from curl_multi_info_read within
> the given time limit, but the call to curl_multi_remove_handle hung for a
> few minutes before it came back. It seems 'remove handle' actually calls
> Curl_done -> Curl_resolver_cancel, and finally trying to 'join' that
> resolver thread. Without curl_multi_remove_handle, I wouldn't be able to
> reuse that easy handle. May I ask how threaded resolver is intended to be
> used?

The resolver is not directly used at all by an application. The application
uses libcurl's API as documented and libcurl will do the proper name resolves
in the backend. The API is independent of what resolver backend that is used.

Now, is curl_multi_remove_handle() can hang due to this, it is either a bug
that can be fixed, or it is due to a more fundamental problem in that
something needs to wait for the thread to die and the name resolve thread
cannot easily be terminated without risking to lose resources.

I haven't really investigated this, but please do and we can get a closer look
on if we can improve this!

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-04-29