Closed ColinDKelley closed 2 years ago
@ioquatix Do you agree that this should be fixed? I've never seen it happen in production...but we'd be appalled if it did. It could cause a total outage of a company's service! Yikes. This feels like a "ticking time bomb".
Why was it added in the first place?
That line hasn't been touched in 7 years: https://github.com/guard/listen/commit/f9e82202d80c84f518918cc199cafc804286a6f0
But it appears to have first been added 8.5 years ago: https://github.com/guard/listen/commit/5e3053d22b7f2ced2230e1192a3426c223056704
Current State
If
:INotify::Notifier.new
(or#watch
) were to raiseErrno::ENOSPC
, the linux driver wouldabort
the containing process:Calling
abort
from a gem is never appropriate.Desired State
Errno::ENOSPC
should be wrapped by raising a named exception (withENOSPC
as the cause). That will raise out of the public interfacestart
. The calling code in the containing process can then take the appropriate action, by rescuing that specific exception or a catch-all base class.Steps to Reproduce
I didn't try, but you'd need to run out the count of
inotify
file descriptors. Then calllistener.start
. That would cause the containing process to abruptlyabort
.