From hc@www.trifle.net  Tue Jul 29 02:58:04 2003
Return-Path: <hc@www.trifle.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id DACB937B401
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 29 Jul 2003 02:58:04 -0700 (PDT)
Received: from www.trifle.net (www.trifle.net [195.24.128.164])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B906F43FA3
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 29 Jul 2003 02:58:01 -0700 (PDT)
	(envelope-from hc@www.trifle.net)
Received: from www.trifle.net (localhost [127.0.0.1])
	by www.trifle.net (8.12.6p2/8.12.6) with ESMTP id h6T9vvIv082704
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 29 Jul 2003 12:57:57 +0300 (EEST)
	(envelope-from hc@www.trifle.net)
Received: (from hc@localhost)
	by www.trifle.net (8.12.6p2/8.12.6/Submit) id h6T9vtbt082701;
	Tue, 29 Jul 2003 12:57:55 +0300 (EEST)
Message-Id: <200307290957.h6T9vtbt082701@www.trifle.net>
Date: Tue, 29 Jul 2003 12:57:55 +0300 (EEST)
From: Roman Nikitchenko <hc@www.trifle.net>
Reply-To: Roman Nikitchenko <hc@trifle.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: btoken close() on kqueue filter descriptors.
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         55007
>Category:       kern
>Synopsis:       btoken close() on kqueue filter descriptors.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    mp
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 29 03:00:32 PDT 2003
>Closed-Date:    Thu Aug 14 08:16:55 PDT 2003
>Last-Modified:  Thu Aug 14 08:16:55 PDT 2003
>Originator:     Roman Nikitchenko
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
Trifle Co. Ltd.
>Environment:
System: FreeBSD hc.apex.dp.ua 4.8-STABLE FreeBSD 4.8-STABLE #0: Mon Jul 28 18:51:32 EEST 2003 hc@hc.apex.dp.ua:/usr/src/sys/compile/HC i386
>Description:
    File descriptors obtained through kqueue() call can't be closed using
    uthread_close() because of non-libc_r kqueue() implementation and
    _thread_fd_table checks on uthread_close(). I see this behaviour after
    checks in /usr/src/lib/libc_r/uthread/uthread_close.c in the
    following branches:
    MAIN: after revision 1.14, RELENG_4_8_BP after revision 1.10.2.4.
>How-To-Repeat:
    Link against libc_r anything like this:

	int poller = kqueue();
	if ( close( poller ) < 0 )
	    perror( "close" );
>Fix:
    Write uthread_kqueue() function inserting new kqueue() descriptor into
    _thread_fd_table (maybe better way exists, but this is all i found).

    As workaround: syscall( SYS_close, fd ), but this is too dirty.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->deischen 
Responsible-Changed-By: rwatson 
Responsible-Changed-When: Thu Jul 31 09:26:40 PDT 2003 
Responsible-Changed-Why:  
This appears to be a thread issue, hand off to Dan.  I also 
think this bug may have been fixed by the addition of uthread_kqueue.c 
in -CURRENT, scheduled to be merged in early August, but I haven't 
confirmed that. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=55007 
State-Changed-From-To: open->closed 
State-Changed-By: mp 
State-Changed-When: Thu Aug 14 08:14:48 PDT 2003 
State-Changed-Why:  
A fix for the libc_r kqueue() file descriptor leak has been applied to 
both -current and -stable. 


Responsible-Changed-From-To: deischen->mp 
Responsible-Changed-By: mp 
Responsible-Changed-When: Thu Aug 14 08:14:48 PDT 2003 
Responsible-Changed-Why:  
A fix for the libc_r kqueue() file descriptor leak has been applied to 
both -current and -stable. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=55007 
>Unformatted:
