glyustb / mogilefs

Automatically exported from code.google.com/p/mogilefs
0 stars 0 forks source link

client Backend.pm #20

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Really old bug report from veoh:

While testing MogileFS, I bumped into an issue that may not be unique to my 
environment.
 
If a process that contains a MogileFS::Client object closes stdin, as is often 
true if the process is an Apache mod_perl child,  there is
potential for the client to lose readability to its trackers and die in the 
midst of its request.  
 
This event occurs because my systems assign fd(0) to stdin.  If stdin is shut, 
fd(0) goes back into the pool of available descriptors.  If
the system then assigns fd(0) to a tracker socket, &_wait_for_readability of 
Backend.pm always returns false.
 
 sub _wait_for_readability {
     my ($fileno, $timeout) = @_;
     return 0 unless $fileno && $timeout;
     ...
}
 
:: The patch is simple::
   sub _wait_for_readability {
       my ($fileno, $timeout) = @_;
       return 0 unless defined($fileno) && $timeout;
       ...
  }
 
I hope this information helps somebody.
There are also a couple fileno checks in MogileFS::Util that may need review.

Original issue reported on code.google.com by dorma...@rydia.net on 2 Oct 2010 at 10:36