cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-2891595 ] DNS cache - outstanding references can prevent timeout

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Fri, 06 Nov 2009 22:29:32 +0000

Bugs item #2891595, was opened at 2009-11-04 02:07
Message generated for change (Settings changed) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=2891595&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: name resolving/DNS
Group: bad behaviour
Status: Open
Resolution: None
>Priority: 6
Private: No
Submitted By: Constantine Sapuntzakis (csapuntz)
Assigned to: Daniel Stenberg (bagder)
Summary: DNS cache - outstanding references can prevent timeout

Initial Comment:
Heavy use of a DNS entry by multiple threads can prevent it from being ejected from the cache, even after its timeout has been exceeded. This patch attached fixes this issue.

The patch allows a DNS entry to persist outside of the hash cache and be released when the last connection referencing it calls Curl_resolv_unlock.
It also changes the hash abstraction to replace an entry with a new one by default rather than favoring older entries. I checked the other use of the hash abstraction in multi.c and it already assumes that the insert will either succeed or return NULL -- not that it will return the old element.

I've also added some debugging code that helps catch reference leaks. After curl_easy_cleanup() is called on all extant handles, curl_get_ndns() should return 0.

----------------------------------------------------------------------

>Comment By: Daniel Stenberg (bagder)
Date: 2009-11-06 23:29

Message:
Thanks a lot. This seems like a good idea.

Two things on the patch, one question and one request:

Question: In the function Curl_resolv_unlock() the free functions are only
called in inuse is zero AND timestamp is zero. What is the rationale for
checking the timestamp? If it reaches zero uses, why can't it be freed
unregarding of what the time stamp field says? I think it would be suitable
with a comment in the code explaining that, since it is certainly not clear
to me!

Request: the 'ndns' variable looks handy for debugging, but it should then
only be included when a debug build is actually made. Use #ifdef CURLDEBUF
and DEBUGF(ndns++); etc.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=2891595&group_id=976
Received on 2009-11-06

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET