From owner-freebsd-current@FreeBSD.ORG Mon Jun 7 19:41:41 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B9D0516A4D1; Mon, 7 Jun 2004 19:41:41 +0000 (GMT) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5E7B243D46; Mon, 7 Jun 2004 19:41:41 +0000 (GMT) (envelope-from robert@fledge.watson.org) Received: from fledge.watson.org (localhost [127.0.0.1]) by fledge.watson.org (8.12.11/8.12.11) with ESMTP id i57JeiFe013263; Mon, 7 Jun 2004 15:40:44 -0400 (EDT) (envelope-from robert@fledge.watson.org) Received: from localhost (robert@localhost)i57Jeiwf013260; Mon, 7 Jun 2004 15:40:44 -0400 (EDT) (envelope-from robert@fledge.watson.org) Date: Mon, 7 Jun 2004 15:40:44 -0400 (EDT) From: Robert Watson X-Sender: robert@fledge.watson.org To: Brian Feldman In-Reply-To: <20040607192918.GA20308@green.homeunix.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: current@freebsd.org cc: Stefan Ehmann Subject: Re: esd leaking file descriptors X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jun 2004 19:41:41 -0000 On Mon, 7 Jun 2004, Brian Feldman wrote: > > I just tried a kernel from June, 1st: esd doesn't leak any file > > descriptors. So it's definitely a CURRENT problem. > > > > I couldn't spot anything suspicous using ktrace (That is no notable > > difference compared to the other machine). > > > > Here are two excerpts from kdump output that basically repeat all the > > time: > > I see a lot of accept(2) there... I think it's a good possibility Robert > accidentally broke accept[1]()'s error cleanup. It seems that the file > is dropped but the fd is left sitting around in a half-allocated state. > Many of those 'goto done;'s should be 'goto noconnection;'s, I believe. That's what I was wondering -- it looks like the 'goto done's following falloc()'s failure check should be "goto noconnection". Here's a patch that cleans that up, but may not be perfect. Robert N M Watson FreeBSD Core Team, TrustedBSD Projects robert@fledge.watson.org Senior Research Scientist, McAfee Research Index: uipc_syscalls.c =================================================================== RCS file: /data/ncvs/src/sys/kern/uipc_syscalls.c,v retrieving revision 1.187 diff -u -r1.187 uipc_syscalls.c --- uipc_syscalls.c 7 Jun 2004 09:59:50 -0000 1.187 +++ uipc_syscalls.c 7 Jun 2004 19:38:39 -0000 @@ -285,7 +285,7 @@ if ((head->so_state & SS_NBIO) && TAILQ_EMPTY(&head->so_comp)) { ACCEPT_UNLOCK(); error = EWOULDBLOCK; - goto done; + goto noconnection; } while (TAILQ_EMPTY(&head->so_comp) && head->so_error == 0) { if (head->so_state & SS_CANTRCVMORE) { @@ -296,14 +296,14 @@ "accept", 0); if (error) { ACCEPT_UNLOCK(); - goto done; + goto noconnection; } } if (head->so_error) { error = head->so_error; head->so_error = 0; ACCEPT_UNLOCK(); - goto done; + goto noconnection; } so = TAILQ_FIRST(&head->so_comp); KASSERT(!(so->so_qstate & SQ_INCOMP), ("accept1: so SQ_INCOMP"));