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

Re-raise exception is missing backtrace #1459

Closed
ioquatix opened this issue Nov 7, 2018 · 5 comments
Closed

Re-raise exception is missing backtrace #1459

ioquatix opened this issue Nov 7, 2018 · 5 comments
Assignees
Labels
Milestone

Comments

@ioquatix
Copy link
Contributor

ioquatix commented Nov 7, 2018

#!/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>'
@chrisseaton
Copy link
Collaborator

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

@ioquatix
Copy link
Contributor Author

It makes debugging tricky.

@eregon eregon added the bug label Nov 13, 2018
@deepj
Copy link

deepj commented Nov 15, 2018

@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.

@eregon eregon self-assigned this Nov 15, 2018
@eregon
Copy link
Member

eregon commented Nov 15, 2018

I'll take a look at this.

@dougxc dougxc closed this as completed in f780b49 Nov 16, 2018
@eregon eregon added this to the 1.0.0-rc10 milestone Nov 16, 2018
@eregon
Copy link
Member

eregon commented Nov 16, 2018

I fixed it in 71b186f, 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants