cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Running out of sockets

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 1 Dec 2004 16:43:01 -0800

On Wed, Dec 01, 2004 at 02:17:56PM -0800, Rob Booth wrote:
> Dan,
>
> Thanks in testing that shows my sockets being closed within 5 seconds of
> being open instead of the almost 1 minute that I had before.

Keep in mind the danger of this--heed the warnings in the sysctl
documentation. The danger of these options is that in the case of
network delays or congestion, stale TCP packets or legitimate TCP retries
may still be floating around the network long after 5 seconds is up.
If one of these arrives after the socket is reused, it could seriously
mess up your connections.

If you are on a local LAN, in control all both sides of the connection,
and know exactly what you're doing, this isn't likely to be a problem
for you. But if you try doing this over the Internet or over a
high-latency network segment, it could end up biting you. RFC1337 has
a discussion about some of the issues involved.

>>> Dan

>
> Rob
>
> -----Original Message-----
> From: Dan Fandrich [mailto:dan_at_coneharvesters.com]
> Sent: Wednesday, December 01, 2004 1:00 PM
> To: 'curl-library_at_cool.haxx.se'
> Subject: Re: Running out of sockets
>
>
> On Wed, Dec 01, 2004 at 12:47:20PM -0800, Rob Booth wrote:
> > Looking at my network statistics I see my sockets end up hanging around
> for
> > approximately 1 minute from the time of release. What I want to know is,
> is
> > there a way to force my operating system (Linux - Red Hat) to release
> those
> > connections as soon as I'm done with them? I'm sure this isn't really a
> > libCURL issue, but I thought this would be the best place to get an
> answer.
>
> Try
> sysctl -w net.ipv4.tcp_tw_recycle=1
> and/or
> sysctl -w net.ipv4.tcp_tw_reuse=1
>
> >>> Dan
> --
> http://www.MoveAnnouncer.com The web change of address service
> Let webmasters know that your web site has moved
Received on 2004-12-02