From owner-freebsd-questions@FreeBSD.ORG Wed Jun 18 14:47:36 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D6B71065676 for ; Wed, 18 Jun 2008 14:47:36 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (wojtek.tensor.gdynia.pl [IPv6:2001:4070:101:2::1]) by mx1.freebsd.org (Postfix) with ESMTP id A98148FC14 for ; Wed, 18 Jun 2008 14:47:35 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (localhost [IPv6:::1]) by wojtek.tensor.gdynia.pl (8.14.2/8.14.2) with ESMTP id m5IElSra034456; Wed, 18 Jun 2008 16:47:28 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from localhost (wojtek@localhost) by wojtek.tensor.gdynia.pl (8.14.2/8.14.2/Submit) with ESMTP id m5IElSgw034453; Wed, 18 Jun 2008 16:47:28 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Date: Wed, 18 Jun 2008 16:47:27 +0200 (CEST) From: Wojciech Puchar To: Ali Niknam In-Reply-To: <4859197A.8040203@transip.nl> Message-ID: <20080618164345.B34431@wojtek.tensor.gdynia.pl> References: <4859197A.8040203@transip.nl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-questions@freebsd.org Subject: Re: Sockets stuck in CLOSED state... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jun 2008 14:47:36 -0000 > ... > 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...