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-1376945 ] CLOSE_WAIT problem

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Mon, 12 Dec 2005 14:42:12 -0800

Bugs item #1376945, was opened at 2005-12-09 09:12
Message generated for change (Settings changed) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1376945&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: https
Group: bad behaviour
>Status: Closed
>Resolution: Works For Me
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_init->curl_easy_perform-
>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.

Evgeny

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

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

Message:
Logged In: YES
user_id=738516

FYI, CURLOPT_FORBID_REUSE fixed the problem.
think need to investigate it or document this solution for
application with persistent curl handle.

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

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

Message:
Logged In: YES
user_id=1110

Explicit close when perform() is done is forced with
CURLOPT_FORBID_REUSE.

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

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

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

Message:
Logged In: YES
user_id=738516

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

Message:
Logged In: YES
user_id=1110

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
in CLOSE_WAIT.

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:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1376945&group_id=976
Received on 2005-12-12

These mail archives are generated by hypermail.

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

File upload with ASP.NET