Haxx ad

curl's project page on


cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-1376945 ] CLOSE_WAIT problem

From: <>
Date: Fri, 09 Dec 2005 00:31:01 -0800

Bugs item #1376945, was opened at 2005-12-09 09:12
Message generated for change (Comment added) made by bagder
You can respond by visiting:

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: https
Group: bad behaviour
Status: Open
Resolution: None
Priority: 5
Submitted By: Evgeny Sabelsky (evgenys)
Assigned to: Daniel Stenberg (bagder)
Summary: CLOSE_WAIT problem

Initial Comment:
curl 7.15.1 (i686-pc-linux-gnu) libcurl/7.15.1
OpenSSL/0.9.8a zlib/1.1.3
Protocols: tftp ftp gopher telnet dict ldap http file
https ftps
Features: IPv6 Largefile NTLM SSL libz

In multithread application several threads is doing
https requests to localhost, every request is
>curl_easy_cleanup), sometime libCurl (or openssl??)
do not close sockets and after a bunch of requests i
see handreds of CLOSE_WAIT strings in nestat.
CLOSE_WAIT disappears if i close my application.

i checked, curl_easy_cleanup called EVERY TIME.



>Comment By: Daniel Stenberg (bagder)
Date: 2005-12-09 09:31

Logged In: YES

Explicit close when perform() is done is forced with

And yes, libcurl _does_ close the connections in cleanup().


Comment By: Evgeny Sabelsky (evgenys)
Date: 2005-12-09 09:27

Logged In: YES

Ok, i'll try to reproduce it in a small app.
How can i force close ? I have checked _cleanup method,
seems like it should cleans connections by

  while(-1 != ConnectionKillOne(data))
    ; /* empty loop */


Comment By: Daniel Stenberg (bagder)
Date: 2005-12-09 09:21

Logged In: YES

How many threads? How many sockets are in CLOSE_WAIT?

libcurl keep sockets "open" by default after a
curl_easy_perform(), to be prepared to re-use the connection
on a subsequent call to it again. But if the call doesn't
come within a limited time, the remote server might decide
to close down the connection anyway and the socket ends up

You can avoid this by forcing libcurl to close the sockets
after use, which then of course disables persistent
connections on subsequent calls.

Can you reproduce this problem with a small stand-alone app
that you can provide the source for?


You can respond by visiting:
Received on 2005-12-09

These mail archives are generated by hypermail.

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

File upload with ASP.NET