cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: DNS cache time out problems

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 3 Nov 2006 16:42:15 +0100 (CET)

On Fri, 3 Nov 2006, Frank Hempel wrote:

> I'm facing the problem that from time to time I get a lot
> CURLE_COULDNT_RESOLVE_HOST errors despite all easy handles which are used
> are sharing the same shared handle which is setup for dns cache sharing. I'm
> initializing the easy handle with the setopt argument
> CURLOPT_DNS_CACHE_TIMEOUT = -1 in the hope that the once resolved hostnames
> will survice the live of an easy handle. Nevertheless the resolutions seem
> to get invalidated sometimes. I should mention that I am querying three
> host(name)s only all the time.

What libcurl version on what platform? Are you using c-ares? If so, what
version?

You are setting CURLOPT_DNS_CACHE_TIMEOUT in each easy handle, right?

> I couldnt figure out an explicit interval after which the
> CURLE_COULDNT_RESOLVE_HOST errors occur because if the dns servers are
> responding well then I get no error of course. I just took notice of it in
> the last time when the dns servers I use got a bit lame.
>
> Is there any hardwired timeout for the dns cache or did I misunderstood the
> using of the sharing handle?

It defaults to 60 seconds, but if you set it to -1 it should never prune
entries from the cache. See curl/lib/hostip.c:Curl_hostcache_prune().

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2006-11-03