From owner-freebsd-current@FreeBSD.ORG Fri Dec 26 16:18:24 2003 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 C11FE16A4CE for ; Fri, 26 Dec 2003 16:18:24 -0800 (PST) Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by mx1.FreeBSD.org (Postfix) with SMTP id 5C59543D53 for ; Fri, 26 Dec 2003 16:18:22 -0800 (PST) (envelope-from dwmalone@maths.tcd.ie) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 27 Dec 2003 00:18:21 +0000 (GMT) Date: Sat, 27 Dec 2003 00:18:20 +0000 From: David Malone To: freebsd-current@freebsd.org Message-ID: <20031227001820.GA89334@walton.maths.tcd.ie> References: <20031224154121.GA83770@e-Gitt.NET> <20031225204626.GA68589@e-Gitt.NET> <20031225215838.GB68589@e-Gitt.NET> <20031225222029.GC68589@e-Gitt.NET> <20031226002654.GB6757@e-Gitt.NET> <20031226162329.GA79023@e-Gitt.NET> <20031226190356.GD79023@e-Gitt.NET> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031226190356.GD79023@e-Gitt.NET> User-Agent: Mutt/1.5.3i Sender: dwmalone@maths.tcd.ie Subject: Re: file descriptor leak in 5.2-RC 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: Sat, 27 Dec 2003 00:18:24 -0000 > during the machine is running on high load and after going to single > user mode. You can clearly see, that even though kern.openfiles still > shows a high number, pstat -f only finds very few files. Ahhh crud - the kern.file sysctl isn't completly calculated from the list of all open files - it iterates through all the processes to form the final list. Could you try rerunning pstat with the patch below - it walks the full open file list, rather than checking each process (this may leak open file info to people within jails on the machine, hopefully that is not a problem for you...) (You'll need to recompile your kernel, but not anything else...) If the files start to show up here, then we can begin to figure out where they're comming from. David. Index: sys/kern/kern_descrip.c =================================================================== RCS file: /cvs/FreeBSD-CVS/src/sys/kern/kern_descrip.c,v retrieving revision 1.215 diff -u -r1.215 kern_descrip.c --- sys/kern/kern_descrip.c 19 Oct 2003 20:41:06 -0000 1.215 +++ sys/kern/kern_descrip.c 27 Dec 2003 00:01:06 -0000 @@ -2312,6 +2312,24 @@ error = 0; bzero(&xf, sizeof(xf)); xf.xf_size = sizeof(xf); + /* DMXXX */ + sx_slock(&filelist_lock); + LIST_FOREACH(fp, &filehead, f_list) { + xf.xf_fd = 0; + xf.xf_file = fp; + xf.xf_data = fp->f_data; + xf.xf_type = fp->f_type; + xf.xf_count = fp->f_count; + xf.xf_msgcount = fp->f_msgcount; + xf.xf_offset = fp->f_offset; + xf.xf_flag = fp->f_flag; + error = SYSCTL_OUT(req, &xf, sizeof(xf)); + if (error) + break; + } + sx_sunlock(&filelist_lock); + return (error); + /* DMXXX */ sx_slock(&allproc_lock); LIST_FOREACH(p, &allproc, p_list) { PROC_LOCK(p);