Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backtrace of the "stream closed" exception is wrong #4913

Closed
yamam opened this issue Dec 27, 2017 · 2 comments
Closed

backtrace of the "stream closed" exception is wrong #4913

yamam opened this issue Dec 27, 2017 · 2 comments

Comments

@yamam
Copy link

yamam commented Dec 27, 2017

Environment

jruby 9.1.15.0 (2.3.3) 2017-12-07 929fde8 Java HotSpot(TM) Client VM 25.144-b01 on 1.8.0_144-b01 +jit [mswin32-x86]

Expected Behavior

close_test.rb

r, w = IO.pipe

Thread.new {
    sleep 1
    r.close
}

begin
    r.gets
rescue
    puts $!, $!.backtrace
end

MRI

$ ruby close_test.rb
stream closed
close_test.rb:9:in `gets'
close_test.rb:9:in `<main>'

The backtrace is the one when calling gets.

Actual Behavior

jruby 9.1.15.0

$ jruby close_test.rb
stream closed
org/jruby/RubyIO.java:1985:in `close'
close_test.rb:5:in `block in close_test.rb'

The backtrace is the one when calling close.

@headius
Copy link
Member

headius commented Jan 25, 2018

This appears to be fixed in 9.1.16, possibly due to work I did on threads and closing IO streams in dad9ab0.

@headius headius closed this as completed Jan 25, 2018
@headius
Copy link
Member

headius commented Jan 25, 2018

[] ~/projects/jruby $ cat blah.rb
r, w = IO.pipe

Thread.new {
    sleep 1
    r.close
}

begin
    r.gets
rescue
    puts $!, $!.backtrace
end

[] ~/projects/jruby $ jruby -v blah.rb
jruby 9.1.16.0-SNAPSHOT (2.3.3) 2018-01-25 2cb38f3 Java HotSpot(TM) 64-Bit Server VM 25.131-b11 on 1.8.0_131-b11 +jit [darwin-x86_64]
stream closed
org/jruby/RubyIO.java:2307:in `gets'
blah.rb:9:in `<main>'

@enebo enebo added this to the Invalid or Duplicate milestone Feb 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants