Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Dec 2003 14:01:21 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>
To:        Oliver Brandmueller <ob@e-Gitt.NET>
Cc:        freebsd-current@freebsd.org
Subject:   Re: file descriptor leak in 5.2-RC
Message-ID:  <Pine.BSF.4.53.0312271351310.21415@e0-0.zab2.int.zabbadoz.net>
In-Reply-To: <20031227132932.GA86308@e-Gitt.NET>
References:  <20031227123148.GB77531@e-Gitt.NET> <200312271253.aa04019@salmon.maths.tcd.ie> <20031227132932.GA86308@e-Gitt.NET>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 27 Dec 2003, Oliver Brandmueller wrote:

> Hi.
>
> On Sat, Dec 27, 2003 at 12:53:20PM +0000, David Malone wrote:
> > Hmmm - could be... The following patch to fstat prints the data
> > field for inodes in fstat's output. I'd suggest:
> >
> > 	1) Run until you have alot of the same inode stuck open.
> > 	2) Run pstat -f and get the data value.
> > 	3) Run fstat and grep for the data value in question.
> >
> > You might need to do 3 a few times, depending on how long the phantom
> > inode is actually open for while the program is running. I wonder
> > if it is some sort of device cloning/refcounting problem?
>
> It's /dev/null !
>
> lupin# pstat -f
> 2779/262144 open files
>    LOC   TYPE   FLG  CNT MSG   DATA        OFFSET
> c7effd8c pipe     RW   2   0 c7968560                0
> c7a9d880 pipe     RW   3   0 c789a35c                0
> c7fbadd0 inode    RW   1   0 c72fae38                0
> c7aea374 inode    RW   1   0 c72fae38                0
> c7fbad8c inode    RW   1   0 c72fae38                0
> c7f9f550 inode    RW   1   0 c72fae38                0
> c7fba61c inode    RW   1   0 c72fae38                0
> [...]
>
> lupin# fstat | fgrep c72fae38 | head -20
> vscan    perl        8817    0 0xc72fae38  /dev          8 crw-rw-rw-    null  r
> vscan    perl        8817    1 0xc72fae38  /dev          8 crw-rw-rw-    null  w
> vscan    perl        8817    2 0xc72fae38  /dev          8 crw-rw-rw-    null  w
> vscan    perl        8718    0 0xc72fae38  /dev          8 crw-rw-rw-    null  r
> vscan    perl        8718    1 0xc72fae38  /dev          8 crw-rw-rw-    null  w
> vscan    perl        8718    2 0xc72fae38  /dev          8 crw-rw-rw-    null  w


when daemonizing you open /dev/null and dup2 it to 0,1,2
to detach from stdin,out,err.

-- 
Bjoern A. Zeeb				bzeeb at Zabbadoz dot NeT
56 69 73 69 74				http://www.zabbadoz.net/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.53.0312271351310.21415>