curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Resolving Timeouts with /etc/hosts

From: Damon Earp via curl-library <curl-library_at_cool.haxx.se>
Date: Thu, 7 May 2020 11:19:48 -0500

Here is a sanitized and shortened version of the hosts file. There are < 40
entries before shortening. The only peculiarity I can see is we have the
node's IP duplicated. The file is being generated via salt, and since we
are lazy we didn't think that would be an issue.

127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
10.0.0.6 nodename-06
10.0.0.1 nodename-01
10.0.0.2 nodename-02
10.0.0.3 nodename-03
10.0.0.4 nodename-04
10.0.0.5 nodename-05
10.0.0.6 nodename-06
10.0.0.7 nodename-07
10.0.0.8 nodename-08

I guess a quick fix, for us, would be to set CURLOPT_DNS_CACHE_TIMEOUT to
-1. Let it do the actual DNS lookup and be done.
Thanks,
Damon

On Thu, May 7, 2020 at 5:40 AM Daniel Stenberg <daniel_at_haxx.se> wrote:

> On Tue, 5 May 2020, Damon Earp via curl-library wrote:
>
> > I'm seeing requests fail due to "Resolving timed out after 2501
> > milliseconds" and all the hostnames that are being resolved are in
> > /etc/hosts. I am building both libcurl and c-ares from source, and
> > statically linking them into the binary.
>
> That totally sounds like a c-ares bug. I don't even think c-ares reads
> that
> file asynchronously so it should return very quickly from that (and the
> actually reading of the file cannot timeout). It rather seems like c-ares
> (when it takes a long time) rather doesn't find it in the /etc/hosts file
> and
> goes to try to DNS it.
>
> I would suspect some peculiarity in the /etc/hosts file that triggers
> this,
> but that's just my guess.
>
> --
>
> / daniel.haxx.se | Commercial curl support up to 24x7 is available!
> | Private help, bug fixes, support, ports, new features
> | https://www.wolfssl.com/contact/
>

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-05-07