cURL / Mailing Lists / curl-library / Single Mail


Re: Multi-threading and name resolution issues

From: Jay Sastry <>
Date: Sat, 6 Aug 2011 10:59:07 -0700

> I want my program to be fault tolerant to certain errors, so I intercept
>> the CURL_COULDNT_CONNECT error and reset the handle. I would like to know
>> why my program cannot recover from this error after doing a
>> curl_easy_duphandle. I am able to connect to the server outside of my
>> program without any problem.
> That seems odd. Does it have a single IP or a DNS name that resolves to
> multiple?

It has a single IP.

> I am investigating all components in the middle between the end points to
>> track down the root cause, but I still expect my program to recover from
>> such errors after resetting the handle.
> I don't. As CURLE_COULDNT_CONNECT indicates such a major problem that is
> outside libcurl's realms I don't see how any kind of reset of libcurl will
> make that problem go away.
> Can you explain to me why it would?
As I mentioned I have no problems connecting to the other server; the
program has been running for more than 30 hours and I have not noticed any
problems. But, when it comes to the server on the different sub-domain, I
get the connection error after 30 hours of running and don't ever recover. I
can connect to the "problem" server outside of my program (using a browser).
I have sniffed the traffic using tcdump, but there is no outbound activity
(from my program to the problem server) whatsoever. I do notice, as
expected, traffic to the non-problem server.
I suspected some kinda resource leak, but if connection errors are due to a
resource leak, then I would expect the connection to fail to all servers not
just one server. I am going through my code with a fine tooth comb to see if
there are any resource leaks, but I haven't found any so far. One thing
though, the program is downloading very large files from the problem server,
I wonder if that could be the root cause (I am currently investigating any
file descriptor leaks). If I restart my program then everything works just
fine, which leads me to suspect my code (maybe the way I am using
libcurl?).I hope this additional info will help diagnose my problem.
I am setting the debug flag in libcurl to get more logging from curl to see
if I can get some clue where my program is failing. I just have to wait
several hours before I hit the error. I have tried both IP address and host
name in my testing. Both fail after 30 hours or so; I get connection error
for IP and host name resolution error for host name.

List admin:
Received on 2011-08-06