Re: file descriptor leak in 5.2-RC

From: Bjoern A. Zeeb <bzeeb-lists_at_lists.zabbadoz.net>
Date: Sat, 27 Dec 2003 14:01:21 +0000 (UTC)
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/
Received on Sat Dec 27 2003 - 05:01:35 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:35 UTC