mogstored file descriptor leak

Brad Fitzpatrick brad at danga.com
Mon Aug 15 07:42:04 PDT 2005


What AIO mode you using?

I wasn't able to reproduce this using whatever my default is, so I'm
guessing it's AIO-mode specific?


On Sun, 14 Aug 2005, Cory Bennett wrote:

> Another tidbit, it seems lsof says all the file handle are opened for
> readonly.  The open from the code snip we both saw only opens it up for
> write.  The is some lines from my lsof:
>
> mogstored  7570      mogile    9r      REG        3,2      129
> 1966143 /var/mogdata/dev1/usage
>
> mogstored  7570      mogile   10r      REG        3,2      129
> 1966151 /var/mogdata/dev3/usage
>
> mogstored  7570      mogile   11r      REG        3,2      129
> 1966150 /var/mogdata/dev2/usage
>
> Any hints where to look for some code that could be opening up the usage file
> for read only?
>
> -Cory
>
> On Sunday 14 August 2005 10:38 pm, Cory Bennett wrote:
> > On Sunday 14 August 2005 8:40 pm, Brad Fitzpatrick wrote:
> > > Great bug report.  I thought it'd be easy to find, but mogstored in cvs
> > > (1.14) is pretty clear:
> > >
> > >             # open a file on that disk location called 'usage'
> > >             my $rv = open(FILE, ">$disk/usage");
> > >             unless ($rv) {
> > >                 $err->("Unable to open '$disk/usage' for writing: $!");
> > >                 next;
> > >             }
> > >             foreach (sort keys %$output) {
> > >                 print FILE "$_: $output->{$_}\n";
> > >             }
> > >             close FILE;
> >
> > Yeah, It is the same version I am using.  I saw this code right away, and
> > seemed obvious.  So I added a bunch of debug statements, printing out the
> > $rv and also the fileno(FILE).  Using lsof I could see the file numbers,
> > but the one printed by fileno(FILE) never showed up in lsof for mogstored.
> > My conclusion was that the above code is working correctly and that the
> > leaked descriptor is coming from somewhere else.  I have been trying to
> > find a 'clever' way to intercept the open and sysopen calls so I can get a
> > stack trace, but I have not had much luck yet.
> >
> > -Cory
>
>


More information about the mogilefs mailing list