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

Already on GitHub? Sign in to your account

Thread.abort_on_exception = true propagates late and breaks #value exceptions #432

Closed
headius opened this Issue Dec 7, 2012 · 1 comment

Comments

Projects
None yet
2 participants
Owner

headius commented Dec 7, 2012

The late propagation is probably due to our being more and more conservative about polling for cross-thread events. I'm not sure what's causing #value to no longer propagate the exception.

You can see the result in the second JRuby run below, where #value does not raise the exception. Instead, it is passed to the main thread, which eventually gets around to checking it after it has exited the surrounding block.

This was causing failures in the twitter gem's specs since exceptions expected to be raised were raised outside the spec block.

system ~/projects/twitter $ jruby -e "begin; begin; Thread.new {raise}.value; rescue Exception; puts 'first rescue'; end; puts 'after'; rescue Exception; puts 'second rescue'; end"first rescue
after

system ~/projects/twitter $ ruby-1.9.3 -e "begin; begin; Thread.new {raise}.value; rescue Exception; puts 'first rescue'; end; puts 'after'; rescue Exception; puts 'second rescue'; end"
first rescue
after

system ~/projects/twitter $ ruby-1.8.7-p358 -e "begin; begin; Thread.new {raise}.value; rescue Exception; puts 'first rescue'; end; puts 'after'; rescue Exception; puts 'second rescue'; end"
first rescue
after

system ~/projects/twitter $ jruby -e "Thread.abort_on_exception = true; begin; begin; Thread.new {raise}.value; rescue Exception; puts 'first rescue'; end; puts 'after'; rescue Exception; puts 'second rescue'; end"
second rescue

system ~/projects/twitter $ ruby-1.9.3 -e "Thread.abort_on_exception = true; begin; begin; Thread.new {raise}.value; rescue Exception; puts 'first rescue'; end; puts 'after'; rescue Exception; puts 'second rescue'; end"
first rescue
after

system ~/projects/twitter $ ruby-1.8.7-p358 -e "Thread.abort_on_exception = true; begin; begin; Thread.new {raise}.value; rescue Exception; puts 'first rescue'; end; puts 'after'; rescue Exception; puts 'second rescue'; end"
-e:1: unhandled exception
    from -e:1:in `initialize'
    from -e:1:in `new'
    from -e:1
first rescue
after

@enebo enebo added the JRuby 1.7.x label Feb 17, 2017

@enebo enebo added this to the Won't Fix milestone Feb 17, 2017

Owner

enebo commented Feb 17, 2017

This works in 9k and we will never fix this in 1.7.x as it is winding down....resolving.

@enebo enebo closed this Feb 17, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment