cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_DNS_CACHE_TIMEOUT and DNS queries

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Tue, 19 Apr 2011 15:45:14 -0700

On Tue, Apr 19, 2011 at 06:23:57PM -0400, Pankaj Takawale wrote:
> My environment:
> curl: 7.21.4
> CURLOPT_DNS_CACHE_TIMEOUT: 30 secs
> CURLOPT_DNS_USE_GLOBAL_CACHE: 1
> Connection : persistent
>
> Server breaks connection every minute. Then I use CONNECT_ONLY to make
> connection if its broken, so that subsequent requests always gets good
> connection.
>
> I'm capturing DNS queries (filter: udp port 53). I can see DNS queries
> to targeted server are captured when I start application.
> But after every 30 secs, when DNS cache times out, there are no
> further DNS queries issued by application.
>
> I tried putting breakpoint on lib/url.c:Curl_hostcache_prune
> lib/hostip.c:hostcache_timestamp_remove, and I see cache entry is
> being removed.
> Why further request is not issuing DNS query?
>
> When I turn off DNS caching, I can see DNS queries captured for every request.

Which DNS resolver are you using? Some system resolvers can do their own
caching, preventing further queries on port 53.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-04-20