Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jun 2008 16:47:27 +0200 (CEST)
From:      Wojciech Puchar <wojtek@wojtek.tensor.gdynia.pl>
To:        Ali Niknam <freebsd-questions@transip.nl>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Sockets stuck in CLOSED state...
Message-ID:  <20080618164345.B34431@wojtek.tensor.gdynia.pl>
In-Reply-To: <4859197A.8040203@transip.nl>
References:  <4859197A.8040203@transip.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
> ...
> tcp4      0       0  1.2.3.4.*          4.5.6.7.42149       CLOSED
> tcp4      39      0  1.2.3.4.*          4.5.6.7.54103       CLOSED
> tcp4      35      0  1.2.3.4.*          4.5.6.7.41718       CLOSED
> tcp4      38      0  1.2.3.4.*          4.5.6.7.55618       CLOSED
> tcp4      41      0  1.2.3.4.*          4.5.6.7.44230       CLOSED
> tcp4      39      0  1.2.3.4.*          4.5.6.7.49439       CLOSED
> ...
>
> These never go away; they gradually increase and increase until the 
> application starts giving errors (probably because some socket or 
> filedescriptor limit is reached). When the application is killed these 
> entries disappear.
>
> The application in question is a self written DNS server, multithreaded, and 
> running fine for years without any troubles on both BSD 5.x as well as 6.x. 
> Also 32bits as well as 64bits on 6.x.

do "stupid" thing - in your source add

#define socket TEST_SOCKET
#define connect TEST_CONNECT
#define bind TEST_BIND
#define listen TEST_LISTEN
....all other network functions you use same way here!


and write one .c program where all these TEST_* functions are defined, 
doing the same as  original PLUS logging to file.

after a while (when you see this closed/unclosed connections) stop it and 
look at logs.


i'm almost sure you will notice where is a problem.

possibly threads implementation changed...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080618164345.B34431>