cURL / Mailing Lists / curl-library / Single Mail

curl-library

Windows handles leakage

From: Shmulik Regev <shmulbox_at_gmail.com>
Date: Sun, 26 Jun 2005 17:40:01 +0200

Gentlemen,

With the help of Sysinternal's Process Explorer I've noticed a consistent handles leak
(which is also visible when watching the number of application handles in the Task
Manager). My test application is a simple modification of the test in lib507.c which
accepts an array of URLs (rather than one) and opens multiple easy handles on a single
multi handle. Running it, and watching the number of process handles at the end of the
process will reveal an increase in the number of handle, even after the call to
curl_multi_cleanup . Oddly, if I use URLs that contain actual IP addresses instead of the
host names, the leak doesn't happen. This suggests of course that the problem is in the
resolving process, and indeed Process Explorer will show a non-decreasing number of thread
handles. I'm using curl (7.13.2) with VC++ 6.0. but without c-ares .

Frankly, I was lead to this testing by a _different_ handle leakage (that I'm still trying
to consistently reproduce in a test) in which the handle usage grows, but Process Explorer
reports of handles of type '\Device\Tcp' . I'm pretty sure that in this case the sockets
are actually closed and I am observing a different kind of handle leakage. The only
sockets related code is CURL and I'm using the multi interface quite heavily there.

One last thing, test 507 contains the following lines (starting line 47)
 curl_multi_cleanup(multi);
 curl_easy_cleanup(curls);
which contradicts the documentation of curl_multi_cleanup (which suggests to first remove
the easy handles).

Any help on these issues will be appreciated.

Cheers,
Shmulik Regev
Blue Security Ltd.
Received on 2005-06-26