Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
LocalJumpError: unexpected break in spec/ruby/language/break_spec.rb #4577
jruby 126.96.36.199-SNAPSHOT (2.3.3) 2017-04-28 038f790 OpenJDK 64-Bit Server VM 25.121-b14 on 1.8.0_121-b14 +jit [linux-x86_64]
Which can be reproduced with:
This specific spec is currently excluded in jruby.2.3.mspec so that's why it got unnoticed.
So this is another case where we are propagating the break out like we should, but we don't produce a rescuable LJE until it's too late. So there's some missing logic at the closure boundary (a proc in this case) to know that the break has no target and the LJE needs to start propagating earlier.
referenced this issue
Jun 26, 2017
The full backtrace is
So it seems the stack is unwound until the load call, which is way too far.
Yes, it doesn't stop at the rescue for the reason I mentioned above. We need to raise the LJE immediately when we can determine the break is not valid, so it can be rescued.
A hacky alternative I've considered is to make LJE and superclasses match our non-local flow exceptions, but it would be better to just raise the real one.