Date: Fri, 22 Aug 2003 13:52:44 -0700 (PDT) From: Doug White <dwhite@gumbysoft.com> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/55879: gethostbyname_r leaks kqueue descriptors Message-ID: <20030822205244.1FF9872DD4@carver.gumbysoft.com> Resent-Message-ID: <200308222100.h7ML002v003787@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030822205244.1FF9872DD4>