Closed
Description
Environment
- JRuby:
jruby 9.1.12.0 (2.3.3) 2017-06-15 33c6439 Java HotSpot(TM) 64-Bit Server VM 25.131-b11 on 1.8.0_131-b11 [linux-x86_64]
- Kernel:
Linux maruchan 4.11.0-041100-generic #201705041534 SMP Thu May 4 19:36:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
- Distro:
Ubuntu 17.04
Expected Behavior
The following test case causes a LocalJumpError
exception to be raised, and then properly handles it.
block_with_break = proc { break :foo }
begin
block_with_break.call
rescue Exception => e
puts "Handled #{e} (#{e.class}) successfully!"
end
puts 'done'
On MRI this works as expected:
$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
$ ruby test.rb
Handled break from proc-closure (LocalJumpError) successfully!
done
Actual Behavior
Under JRuby, the code does not seem to be able to catch the LocalJumpError
:
$ jruby -v
jruby 9.1.12.0 (2.3.3) 2017-06-15 33c6439 Java HotSpot(TM) 64-Bit Server VM 25.131-b11 on 1.8.0_131-b11 +jit [linux-x86_64]
$ jruby test.rb
LocalJumpError: unexpected break
(vm exits)
The test case is pretty strange; the real use case where I've bumped into this issue is an app that took a block and created a future from it with concurrent-ruby
. On a rare code path it would call an erroneous break
, and because concurrent-ruby
could not rescue
and mark the background task as failed, the task would appear like it would never finish.
Metadata
Metadata
Assignees
Labels
No labels