cURL / Mailing Lists / curl-library / Single Mail

curl-library

CLOSE_WAIT and socket options

From: Andrei Tarassov <andrei.tarassov_at_altiris.ee>
Date: Wed, 6 Apr 2005 10:00:14 +0200

Hi!

There is a problem with our software, which uses curl as transport. For
some reasons sockets are not properly closed and thus after some time
the application process runs out of free file descriptors. It might be
that the problem is in the incorrect use of curl, but I just want to
make sure that the deal is not with some well-known issue.

The situation is that the sockets is hanging in CLOSE_WAIT state for
hours (at least I did not notice any changes in the output of the lsof
command). On the server side there seems to be nothing known about these
connections. I guess the server has closed its socket, but for some
reasons the client does not know anything about that.

If that is the situation, then my understanding is that the connection
should be closed on the client side as well, at least after some
timeout. However this does not seem to happen.

What I want to know is:

1. Has anyone encountered the same problem and handled it?
2. At what moment curl closes the TCP socket?
3. Is there any way to pass custom options to the curl function, which
creates a socket? I want to try to play with different timeouts a bit.
4. Is there any way to switch off the normal tcp connection closing
procedure, i.e. to close the socket without sending different FIN/ACKs?

Thanks,

--
ANDREI TARASSOV
Software Developer II
Altiris, Inc
www.altiris.com
Received on 2005-04-06