mogstored file descriptor leak

Cory Bennett mogile at
Sun Aug 14 22:38:09 PDT 2005

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. 


More information about the mogilefs mailing list