Getting this error: "LocalJumpError: yield called out of block" #415

Closed
utkarshkukreti opened this Issue Nov 27, 2012 · 3 comments

Projects

None yet

3 participants

@utkarshkukreti

My project started failing on JRuby since these commits.

Here's the full log of running the spec - https://travis-ci.org/utkarshkukreti/calvin/jobs/3365775

Just the error:

Failure/Error: eval1("..100 - ..100").should eq [0] * 100

LocalJumpError:

yield called out of block

If there isn't something obvious from the diff linked above, I'll try to make a reduced test case.

FYI: It works fine on Ruby 1.9.3, Ruby Head as of today, and Rubinius Head in 1.9 mode.

@BanzaiMan
Member

Interesting.

If you evaluate the expression in REPL, it appears that the block is evaluated twice (range.rb:25 appears twice in the back trace below).

Looks like enumerator and/or generator is coming into play. I believe it is a JRuby bug.

> ..100 - ..100
yield called out of block
"yield called out of block"
/private/var/folders/hf/m_mxnhms4q70rqg1dhv8bk400000gp/T/calvin/lib/calvin/ast/range.rb:25:in `each'
org/jruby/RubyNumeric.java:788:in `step'
/private/var/folders/hf/m_mxnhms4q70rqg1dhv8bk400000gp/T/calvin/lib/calvin/ast/range.rb:24:in `each'
org/jruby/RubyEnumerator.java:206:in `each'
file:/Users/asari/Development/src/jruby/lib/jruby.jar!/jruby/kernel/jruby/generator.rb:189:in `_next_element'
file:/Users/asari/Development/src/jruby/lib/jruby.jar!/jruby/kernel/jruby/generator.rb:205:in `end?'
file:/Users/asari/Development/src/jruby/lib/jruby.jar!/jruby/kernel/jruby/generator.rb:219:in `current'
file:/Users/asari/Development/src/jruby/lib/jruby.jar!/jruby/kernel/jruby/generator.rb:210:in `next'
file:/Users/asari/Development/src/jruby/lib/jruby.jar!/jruby/kernel19/enumerator.rb:32:in `next'
/private/var/folders/hf/m_mxnhms4q70rqg1dhv8bk400000gp/T/calvin/lib/calvin/ast/range.rb:25:in `each'
org/jruby/RubyNumeric.java:788:in `step'
/private/var/folders/hf/m_mxnhms4q70rqg1dhv8bk400000gp/T/calvin/lib/calvin/ast/range.rb:24:in `each'
org/jruby/RubyEnumerable.java:1383:in `zip'
/private/var/folders/hf/m_mxnhms4q70rqg1dhv8bk400000gp/T/calvin/lib/calvin/evaluator.rb:169:in `apply_each'
/private/var/folders/hf/m_mxnhms4q70rqg1dhv8bk400000gp/T/calvin/lib/calvin/evaluator.rb:162:in `apply_dyad'
/private/var/folders/hf/m_mxnhms4q70rqg1dhv8bk400000gp/T/calvin/lib/calvin/evaluator.rb:96:in `initialize'
org/jruby/RubyBasicObject.java:1691:in `instance_eval'
/Users/asari/Development/src/jruby/lib/ruby/gems/shared/gems/parslet-1.4.0/lib/parslet/transform.rb:197:in `call_on_match'
/Users/asari/Development/src/jruby/lib/ruby/gems/shared/gems/parslet-1.4.0/lib/parslet/transform.rb:215:in `transform_elt'
org/jruby/RubyArray.java:1612:in `each'
/Users/asari/Development/src/jruby/lib/ruby/gems/shared/gems/parslet-1.4.0/lib/parslet/transform.rb:212:in `transform_elt'
/Users/asari/Development/src/jruby/lib/ruby/gems/shared/gems/parslet-1.4.0/lib/parslet/transform.rb:168:in `apply'
/Users/asari/Development/src/jruby/lib/ruby/gems/shared/gems/parslet-1.4.0/lib/parslet/transform.rb:234:in `recurse_array'
org/jruby/RubyArray.java:2360:in `map'
/Users/asari/Development/src/jruby/lib/ruby/gems/shared/gems/parslet-1.4.0/lib/parslet/transform.rb:234:in `recurse_array'
/Users/asari/Development/src/jruby/lib/ruby/gems/shared/gems/parslet-1.4.0/lib/parslet/transform.rb:170:in `apply'
/private/var/folders/hf/m_mxnhms4q70rqg1dhv8bk400000gp/T/calvin/lib/calvin/cli.rb:60:in `repl'
org/jruby/RubyKernel.java:1392:in `loop'
/private/var/folders/hf/m_mxnhms4q70rqg1dhv8bk400000gp/T/calvin/lib/calvin/cli.rb:27:in `repl'
/private/var/folders/hf/m_mxnhms4q70rqg1dhv8bk400000gp/T/calvin/lib/calvin/cli.rb:8:in `initialize'
/private/var/folders/hf/m_mxnhms4q70rqg1dhv8bk400000gp/T/calvin/bin/calvin:4:in `(root)'
org/jruby/RubyKernel.java:1046:in `load'
/Users/asari/Development/src/jruby/lib/ruby/gems/shared/bin/calvin:23:in `(root)'
@enebo
Member
enebo commented Nov 29, 2012

I just tried this with master and your spec runs through to completion for me. I also did a co of a1a2ff in case you had worked around the problem. Can you try rvm use jruby-head and test against that? We are very close to releasing jruby 1.7.1 and it would be nice to see this was fixed :)

@BanzaiMan
Member

Seems to work fine on the master branch now. https://travis-ci.org/BanzaiMan/calvin/jobs/10916380

Perhaps recent work on enumerators fixed the original issue.

@BanzaiMan BanzaiMan closed this Sep 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment