curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLE_COULDNT_CONNECT error

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 15 Dec 2016 16:28:35 +0100 (CET)

On Wed, 14 Dec 2016, Pushkar Kulkarni wrote:

> There's an issue where we make ~180 GET calls to the *same endpoint* (the
> GitHub API). Internally, for each GET call we seem to be configuring an easy
> handle and then registering it with a multi handle. In one of these
> iterations (randomly), I see libcurl returning CURLE_CANNOT_CONNECT.

That's a failure to connect(). Are you sure this is a libcurl problem and
simply not the server for example saying no to your attempts?

> So, I turned on the verbose mode and before each transfer I could see this:
> [1] Connection #0 to host api.github.com left intact
>
> Only, before the failing connection, I see:
> [1] Connection #0 to host api.github.com left intact
> [1] Closing connection 0`

Right that makes perfect sense because if it reuses the connection it won't
have to do another connect attempt. Only if it actualy closed the previous
connection it will connect again and then risk failing that.

> Nothing else is logged on failure. When I try to use strace, to find the
> failing system call, the failure gets masked.
>
> I am not sure how to proceed with the analysis. Can someone please help me
> take this further, please?

If you build a debug version of the library it will give you clues to why the
connection is closed, which could be a good step towards figuring this out.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html
Received on 2016-12-15