bin/55879: gethostbyname_r leaks kqueue descriptors

Doug White dwhite at gumbysoft.com
Fri Aug 22 14:00:02 PDT 2003


>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 at 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:


More information about the freebsd-bugs mailing list