Fix an infinite loop when attempting to read from a directory#4817
Fix an infinite loop when attempting to read from a directory#4817philr wants to merge 1 commit intojruby:masterfrom
Conversation
Raise Errno::EISDIR instead to match MRI.
|
have tried running this against jruby-9.1 but this time there seems to be more failures from |
|
@kares I'm seeing the same test failures from
I've just merged this onto jruby-9.1 myself (philr/jruby@5d25f7b). Running |
|
oh really? have assumed they're builds from the same base, although I did not look carefully ... |
|
done at 963e2a1 - thanks for the fix |
When attempting to open a directory with
File.openand then read from it, JRuby 9.1.13.0 (on platforms other than Windows) will enter an infinite loop and hang:When attempting to do the same with MRI (tested with versions 1.9.3 through to 2.4.2) an
Errno::EISDIRexception is raised:The hang occurs because
OpenFile.fillbuf()andOpenFile.ioBufread()loop to retry on errors. This is desirable for temporary errors likeEAGAIN, but not for permanent errors likeEISDIR.This pull request modifies
OpenFile.waitReadable()to abort retries when a permanent error is encountered. It also changesHelpers.errnoFromException()to map the"Is a directory"IOExceptionmessage toEISDIR.This change only applies to non-Windows platforms. On Windows,
File.openraises an exception instead.