cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Multi-threading and name resolution issues

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Tue, 2 Aug 2011 23:38:50 -0700

On Tue, Aug 02, 2011 at 05:48:48PM -0700, Jay Sastry wrote:
> I am writing a C++ program that communicates with web-services; I am using
> libcurl to talk HTTP with the web services. My program is multi-threaded and is
> quite chatty with the web services (interacts periodically every few seconds).
> For this reason, I am using a pool of CURL handles to avoid a massive socket
> churn. I have read the documentation and other posts regarding caveats with
> multiple threads, so I have taken care to make sure each handle is used by only
> one thread at a time, although I bounce the handles between different threads.
> I have not encountered any problems in this area. However, I am noticing
> problems connecting to the web server after a few hours(I am getting a
> CURLE_COULDNT_CONNECT error). I am suspecting this could be due to the name
> resolution issue. I am using the libcurl that is baked into Centos 6 and so it
> is not linked against a-res lib.

If libcurl isn't using C-Ares, then it must be using the host resolver (I
believe that the version of libcurl shipped with CentOS predates the threaded
resolver). So, if there is a resolver problem, it could be with the host
resolver. But are you sure there's a resolver problem at all? Have you ruled
out a problem with the remote DNS server or a network problem in the middle?
That's the most likely explanation. You could also try compiling your own
libcurl against C-Ares for testing and see if the problem goes away.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-08-03