Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Open
headius opened this Issue · 0 comments

1 participant

@headius
Owner

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.