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: Question about DNS timeout in libCurl

From: Daniel Stenberg via curl-library <curl-library_at_lists.haxx.se>
Date: Sat, 11 Dec 2021 12:34:05 +0100 (CET)

On Fri, 10 Dec 2021, Dmitry Karpov wrote:

>> that timeout logic in curl is also only used when an old c-ares version
>> is used
>
> Could you please clarify the last point about the old c-ares version? I
> stepped on this issue using c-ares 1.17.1, which I think it is not that old.

Because we prefer ares_getaddrinfo() now and then c-ares gets both A and AAAA
addresses by itself.

> I agree with you that it is mostly a c-ares problem but lowering the default
> timeout in c-ares itself may create sudden issues in the apps that rely on
> this value.

If we believe it would cause issues when lowered in c-ares, why will it not
cause issues if lowered in libcurl? To me, it seems like a value that should
be safe to lower in both or in neither...

> The current libcurl version hard codes this value and relies on this as a
> c-ares documented feature, so I doubt that the default c-ares timeout will
> change in the future to avoid issues with existing apps.

The timeout that isn't used by current libcurl with current c-ares you mean.
But libcurl can configure c-ares to use a specific timeout that's right.

> So, the most logical way to decrease the default DNS timeout used in libcurl
> seems to implement some logic controlling timing of DNS queries. In case of
> c-ares used as a DNS resolver, such logic may use c-ares API for setting the
> timeout, for other resolvers it may use something else or just rely on the
> defaults.

The order and preference I would like to see this handled:

  1. Make c-ares use a better default timeout or method to avoid long waits,
     possibly by doing more in parallel
  2. Find and use a better default timeout for c-ares
  3. Find and use a better default c-ares timeout set by libcurl
  4. Only if the above solutions cannot be made to work, I think we should
     consider allowing this to be set by an application using libcurl.

-- 
  / daniel.haxx.se
  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features
  | https://curl.se/support.html
-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2021-12-11