From owner-freebsd-bugs@FreeBSD.ORG Fri Aug 22 14:00:02 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 37CCE16A4BF for ; Fri, 22 Aug 2003 14:00:02 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 04B0F43FE5 for ; Fri, 22 Aug 2003 14:00:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h7ML00Up003788 for ; Fri, 22 Aug 2003 14:00:00 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h7ML002v003787; Fri, 22 Aug 2003 14:00:00 -0700 (PDT) Resent-Date: Fri, 22 Aug 2003 14:00:00 -0700 (PDT) Resent-Message-Id: <200308222100.h7ML002v003787@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Doug White Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7D01716A4BF for ; Fri, 22 Aug 2003 13:52:44 -0700 (PDT) Received: from carver.gumbysoft.com (carver.gumbysoft.com [66.220.23.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2958643F85 for ; Fri, 22 Aug 2003 13:52:44 -0700 (PDT) (envelope-from dwhite@gumbysoft.com) Received: by carver.gumbysoft.com (Postfix, from userid 1000) id 1FF9872DD4; Fri, 22 Aug 2003 13:52:44 -0700 (PDT) Message-Id: <20030822205244.1FF9872DD4@carver.gumbysoft.com> Date: Fri, 22 Aug 2003 13:52:44 -0700 (PDT) From: Doug White To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/55879: gethostbyname_r leaks kqueue descriptors X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Doug White List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Aug 2003 21:00:02 -0000 >Number: 55879 >Category: bin >Synopsis: gethostbyname_r leaks kqueue descriptors >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Aug 22 14:00:00 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Doug White >Release: FreeBSD 4.8-STABLE i386 >Organization: >Environment: System: FreeBSD carver.gumbysoft.com 4.8-STABLE FreeBSD 4.8-STABLE #6: Sat May 3 17:51:53 PDT 2003 root@carver.gumbysoft.com:/usr/obj/usr/src/sys/CARVER i386 >Description: gethostbyname_r(3) does not properly close the kqueue descriptor it uses to wait for DNS query responses. Threaded programs that repeatedly call the gethostbyname_r(3) function eventually run out of file descriptors. kqueue descriptors are only visible with lsof, so if you're going to go look, don't use fstat(8). >How-To-Repeat: I found this with python -- the default python port compiles with thread support, which enables use of gethostbyname_r(3). Recompiling the port with WITHOUT_THREADS and running the test program finds no buildup of kqueue descriptors. I can produce a C pthreads program if desired, I just don't have my book handy right here. A test C program that just calls gethostbyname(3) in a loop doesn't leak either, so it seems limited to the threadsafe variant. >Fix: >Release-Note: >Audit-Trail: >Unformatted: