Truffleruby: Re-raise exception is missing backtrace

Created on 7 Nov 2018  路  5Comments  路  Source: oracle/truffleruby

#!/usr/bin/env ruby

def foo
    raise ArgumentError, "It's broken"
end

def bar
    foo
rescue
    raise
end

begin
    bar
rescue
    puts $!.backtrace
end

In MRI:

exception.rb:4:in `foo'
exception.rb:8:in `bar'
exception.rb:14:in `<main>'

In TruffleRuby, missing backtrace before re-raising

exception.rb:10:in `bar'
exception.rb:14:in `<main>'
bug

Most helpful comment

I fixed it in 71b186f561b68e321a75e6f22063273cca5d9405, this was indeed caused by the lazy backtraces, which need special care when re-raising an existing exception.
The fix will be in the next release, thank you for the report and easy-to-reproduce example!

All 5 comments

This is caused by our lazy backtraces I think. Re-raising needs to force them, possibly.

It makes debugging tricky.

@chrisseaton this would be fixed. I personally agree with @ioquatix this is tricky. I noticed it in many cases and it's really confusing in some point.

I'll take a look at this.

I fixed it in 71b186f561b68e321a75e6f22063273cca5d9405, this was indeed caused by the lazy backtraces, which need special care when re-raising an existing exception.
The fix will be in the next release, thank you for the report and easy-to-reproduce example!

Was this page helpful?
0 / 5 - 0 ratings