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-2891591 ] Curl_dns_entry leaked on redirect + connect failure

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Sun, 15 Nov 2009 01:36:03 +0000

Bugs item #2891591, was opened at 2009-11-03 16:56
Message generated for change (Comment added) made by csapuntz
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=2891591&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: http
Group: bad behaviour
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Constantine Sapuntzakis (csapuntz)
Assigned to: Daniel Stenberg (bagder)
Summary: Curl_dns_entry leaked on redirect + connect failure

Initial Comment:
How to repro:

  1. Set up a first web server that redirects (307) to a http://server:port that's down
  2. Have curl connect to the first web server using curl multi

After the curl_easy_cleanup call, there will be curl dns entries hanging around with in_use != 0.

Working on a patch...

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

>Comment By: Constantine Sapuntzakis (csapuntz)
Date: 2009-11-14 17:36

Message:
This one fixes the leaks by setting conn->dns_entry early and cleaning it
up in Curl_disconnect.

Setting conn->dns_entry early means it doesn't have to be passed around
everywhere.

Passes all tests I could run (no libssh2) including #19

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

Comment By: Daniel Stenberg (bagder)
Date: 2009-11-14 00:45

Message:
When applied, test 19 fails with a memory leak (if configure --enable-debug
was used):

test 019...[attempt connect to non-listening socket]

** MEMORY FAILURE
Leak detected: memory still allocated: 60 bytes
At 836e2e4, there's 16 bytes.
 allocated by curl_addrinfo.c:156
At 836e2b4, there's 32 bytes.
 allocated by curl_addrinfo.c:137
At 836e384, there's 12 bytes.
 allocated by hostip.c:344

 - abort tests

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

Comment By: Constantine Sapuntzakis (csapuntz)
Date: 2009-11-11 16:33

Message:
And for what it's worth, the patch fixes test cases 311 and 312 which now
have memory leaks because of recent DNS hostcache behavior change.

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

Comment By: Constantine Sapuntzakis (csapuntz)
Date: 2009-11-11 09:19

Message:
New patch attached.

Clean up in Curl_disconnect. Along with plugging the DNS ref leak in
multi.c, this allows us to simplify Curl_connect too.

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

Comment By: Constantine Sapuntzakis (csapuntz)
Date: 2009-11-03 18:16

Message:
disconnet_conn = true in multi_runsingle but Curl_done is not always called
- which would clean up the conn->dns_entry. Don't know if it's safe to call
Curl_done so instead I cleanup in disconnect_conn clause no matter what.

Also, maintain invariant in ConnectPlease that if it returns an error then
conn->dns_entry == NULL to avoid double unlocks.

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

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

These mail archives are generated by hypermail.

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

File upload with ASP.NET