Skip to content

sysread hangs on EOF on mac #5287

@andrewdotn

Description

@andrewdotn

Environment

Provide at least:

  • JRuby version (jruby -v) and command line (flags, JRUBY_OPTS, etc)
    jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 Java HotSpot(TM) 64-Bit Server VM 25.161-b12 on 1.8.0_161-b12 +jit [darwin-x86_64]
  • Operating system and platform (e.g. uname -a)
    Darwin localhost 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64

Expected Behavior

With this script, I expect to see EOFError raised:

f = File.open('/etc/passwd', 'r')
loop do
  x = f.sysread(1024)
  puts "read #{x.length}"
end

This is what MRI ruby does, as well as JRuby 9.1.15.0 and earlier.

Actual Behavior

The script hangs at EOF with JRuby 9.2.0.0 on the mac. The Java debugger shows it’s inside RubyThread.select() calling Selector.select(). Linux seems to be unaffected.

git bisect traces it to dad9ab0, which was cherry-picked as 3493a91, so 9.1.16.0 and 9.1.17.0 are affected as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions