New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IRReturnJump unhandled #3713

Closed
chrisseaton opened this Issue Mar 7, 2016 · 22 comments

Comments

Projects
None yet
5 participants
@chrisseaton
Contributor

chrisseaton commented Mar 7, 2016

$ bin/jruby -Sgem install yard
$ bin/jruby lib/ruby/gems/shared/gems/yard-0.8.7.6/bin/yardoc --markup markdown --exclude truffle/src/main/ruby/core/truffle/cext/require\.rb --no-save --readme truffle/README.md truffle/src/main/ruby/core/truffle
[warn]: In file `truffle/src/main/ruby/core/truffle/debug.rb':12: Cannot resolve link to #break from text:
[warn]: ...{#break}...
Unhandled Java exception: IRReturnJump:<Static Type[864852424]: local [text=Truffle::Debug.break]:true>

(Not using Truffle, it's just that it showed up on our CI system when building our documentation)

Might be related to #3673 - not sure.

@chrisseaton chrisseaton added the ir label Mar 7, 2016

@doudou

This comment has been minimized.

Show comment
Hide comment
@doudou

doudou Mar 25, 2016

Possibly related as well: I got the same exception when running rdebug and setting up a break

[...el/jruby/tools-roby]% ruby --debug -G --dev -S rdebug test/test_event_generator.rb
test/test_event_generator.rb:1
require 'roby/test/self'
(rdb:1) break /home/doudou/dev/rock/toolchain-devel/jruby/tools-roby/lib/roby/execution_engine.rb:247
Breakpoint 1 file /home/doudou/dev/rock/toolchain-devel/jruby/tools-roby/lib/roby/execution_engine.rb, line 247
Unhandled Java exception: IRReturnJump:<Static Type[1539947037]: local [code=]:true>

doudou commented Mar 25, 2016

Possibly related as well: I got the same exception when running rdebug and setting up a break

[...el/jruby/tools-roby]% ruby --debug -G --dev -S rdebug test/test_event_generator.rb
test/test_event_generator.rb:1
require 'roby/test/self'
(rdb:1) break /home/doudou/dev/rock/toolchain-devel/jruby/tools-roby/lib/roby/execution_engine.rb:247
Breakpoint 1 file /home/doudou/dev/rock/toolchain-devel/jruby/tools-roby/lib/roby/execution_engine.rb, line 247
Unhandled Java exception: IRReturnJump:<Static Type[1539947037]: local [code=]:true>
@cshupp1

This comment has been minimized.

Show comment
Hide comment
@cshupp1

cshupp1 Jun 2, 2016

When trying to generate any documentation with 9.0.4.0:

I get:

C:\work\ETS\rails_prisme>rake doc:app
rm -r doc/app
Parsing sources...
100% [44/44]  lib/rails_common/util/helpers.rb

Generating Darkfish format into C:/work/ETS/rails_prisme/doc/app...
Unhandled Java exception: IRReturnJump:<Static Type[1557226867]: local [text=# do something with the exception]:true>
C:\work\ETS\rails_prisme>yardoc
Unhandled Java exception: IRReturnJump:<Static Type[1109306750]: local [text=set RAILS_ENV=production]:true>

cshupp1 commented Jun 2, 2016

When trying to generate any documentation with 9.0.4.0:

I get:

C:\work\ETS\rails_prisme>rake doc:app
rm -r doc/app
Parsing sources...
100% [44/44]  lib/rails_common/util/helpers.rb

Generating Darkfish format into C:/work/ETS/rails_prisme/doc/app...
Unhandled Java exception: IRReturnJump:<Static Type[1557226867]: local [text=# do something with the exception]:true>
C:\work\ETS\rails_prisme>yardoc
Unhandled Java exception: IRReturnJump:<Static Type[1109306750]: local [text=set RAILS_ENV=production]:true>

@enebo enebo added this to the JRuby 9.1.3.0 milestone Jun 2, 2016

@enebo

This comment has been minimized.

Show comment
Hide comment
@enebo

enebo Jun 2, 2016

Member

This should not be leaking out of the system (internal exception) and it sounds like rdoc probably hits it pretty easily. I ran yard tests against 9.1.0.0 so I am curious @cshupp1 if you see this same error for yardoc?

Member

enebo commented Jun 2, 2016

This should not be leaking out of the system (internal exception) and it sounds like rdoc probably hits it pretty easily. I ran yard tests against 9.1.0.0 so I am curious @cshupp1 if you see this same error for yardoc?

@cshupp1

This comment has been minimized.

Show comment
Hide comment
@cshupp1

cshupp1 Jun 2, 2016

Yes, I initially saw it in yardoc. The second code section is yardoc btw.

Via rake doc:app I think it is bombing on this file:
https://github.com/VA-CTT/rails_common/blob/develop/util/helpers.rb

cshupp1 commented Jun 2, 2016

Yes, I initially saw it in yardoc. The second code section is yardoc btw.

Via rake doc:app I think it is bombing on this file:
https://github.com/VA-CTT/rails_common/blob/develop/util/helpers.rb

@enebo

This comment has been minimized.

Show comment
Hide comment
@enebo

enebo Jun 2, 2016

Member

@cshupp1 but could you verify this is broken with 9.1.2.0 since I know I did green test run with yard for 9.1.0.0? You said 9.0.4.0 and I am wondering if some/all of this has been corrected in a later release.

Member

enebo commented Jun 2, 2016

@cshupp1 but could you verify this is broken with 9.1.2.0 since I know I did green test run with yard for 9.1.0.0? You said 9.0.4.0 and I am wondering if some/all of this has been corrected in a later release.

@cshupp1

This comment has been minimized.

Show comment
Hide comment
@cshupp1

cshupp1 Jun 2, 2016

I will pull 9.1.2.0 now.

cshupp1 commented Jun 2, 2016

I will pull 9.1.2.0 now.

@cshupp1

This comment has been minimized.

Show comment
Hide comment
@cshupp1

cshupp1 Jun 2, 2016

Still broken...

> irb                                                                                                                   
irb(main):001:0> JRUBY_VERSION                                                                                          
=> "9.1.2.0"                                                                                                            
irb(main):002:0> exit                                                                                                   

cshupp@MSI C:\work\ETS                                                                                                  
> cd rails_prisme                                                                                                       

cshupp@MSI C:\work\ETS\rails_prisme                                                                                     
> yardoc                                                                                                                
Unhandled Java exception: IRReturnJump:<Static Type[1109306750]: local [text=set RAILS_ENV=production]:true>            


cshupp@MSI C:\work\ETS\rails_prisme                                                                                     
> rake doc:app                                                                                                          
rm -r doc/app                                                                                                           
Parsing sources...                                                                                                      
100% [44/44]  lib/rails_common/util/helpers.rb                                                                          

Generating Darkfish format into C:/work/ETS/rails_prisme/doc/app...                                                     
Unhandled Java exception: IRReturnJump:<Static Type[691129299]: local [text=# do something with the exception]:true>                                                                                                                          

cshupp1 commented Jun 2, 2016

Still broken...

> irb                                                                                                                   
irb(main):001:0> JRUBY_VERSION                                                                                          
=> "9.1.2.0"                                                                                                            
irb(main):002:0> exit                                                                                                   

cshupp@MSI C:\work\ETS                                                                                                  
> cd rails_prisme                                                                                                       

cshupp@MSI C:\work\ETS\rails_prisme                                                                                     
> yardoc                                                                                                                
Unhandled Java exception: IRReturnJump:<Static Type[1109306750]: local [text=set RAILS_ENV=production]:true>            


cshupp@MSI C:\work\ETS\rails_prisme                                                                                     
> rake doc:app                                                                                                          
rm -r doc/app                                                                                                           
Parsing sources...                                                                                                      
100% [44/44]  lib/rails_common/util/helpers.rb                                                                          

Generating Darkfish format into C:/work/ETS/rails_prisme/doc/app...                                                     
Unhandled Java exception: IRReturnJump:<Static Type[691129299]: local [text=# do something with the exception]:true>                                                                                                                          
@cshupp1

This comment has been minimized.

Show comment
Hide comment
@cshupp1

cshupp1 Jun 2, 2016

I didn't blow away and reinstall my bundle or anything. I can't imagine that would be needed...

cshupp1 commented Jun 2, 2016

I didn't blow away and reinstall my bundle or anything. I can't imagine that would be needed...

@enebo

This comment has been minimized.

Show comment
Hide comment
@enebo

enebo Jun 2, 2016

Member

@cshupp1 thanks for confirming.

Locally, I can run yarddoc on jruby project home (with lots of various issues with syntax) but so far no IRReturnJump. I am wondering if it only happens when it is roaming over some specific ruby syntax? Using @chrisseaton command-line on Truffle no longer seems to be an issue for me.

I will poke a little bit.

Member

enebo commented Jun 2, 2016

@cshupp1 thanks for confirming.

Locally, I can run yarddoc on jruby project home (with lots of various issues with syntax) but so far no IRReturnJump. I am wondering if it only happens when it is roaming over some specific ruby syntax? Using @chrisseaton command-line on Truffle no longer seems to be an issue for me.

I will poke a little bit.

@cshupp1

This comment has been minimized.

Show comment
Hide comment
@cshupp1

cshupp1 Jun 2, 2016

If it helps, you can grab our source.

https://github.com/VA-CTT/rails_prisme

The read me has instructions on the sub-module. I suspect the issue is there.

cshupp1 commented Jun 2, 2016

If it helps, you can grab our source.

https://github.com/VA-CTT/rails_prisme

The read me has instructions on the sub-module. I suspect the issue is there.

@enebo

This comment has been minimized.

Show comment
Hide comment
@enebo

enebo Jun 2, 2016

Member

@cshupp1 ok hopefully I see the issue. I tried running rdoc on empty Rails app and did not hit any issues...

Member

enebo commented Jun 2, 2016

@cshupp1 ok hopefully I see the issue. I tried running rdoc on empty Rails app and did not hit any issues...

@enebo

This comment has been minimized.

Show comment
Hide comment
@enebo

enebo Jun 2, 2016

Member
system ~/work/rails_common develop 3503% jruby -S rdoc --main README.md --title 'My Fancy Title' README.md **/*.rb
jruby -S rdoc --main README.md --title 'My Fancy Title' README.md **/*.rb
Ignoring interception-0.5 because its extensions are not built.  Try: gem pristine interception --version 0.5
Parsing sources...
100% [ 7/ 7]  util/helpers.rb

Generating Darkfish format into /Users/enebo/work/rails_common/doc...

  Files:       7

  Classes:     0 ( 0 undocumented)
  Modules:     7 ( 7 undocumented)
  Constants:  16 (12 undocumented)
  Attributes:  1 ( 1 undocumented)
  Methods:    12 ( 8 undocumented)

  Total:      36 (28 undocumented)
   22.22% documented

  Elapsed: 2.9s

system ~/work/rails_common develop 3504% cd ../rails_prisme/
cd ../rails_prisme/
system ~/work/rails_prisme develop 3505% jruby -S rdoc --main README.md --title 'My Fancy Title' README.md **/*.rb
jruby -S rdoc --main README.md --title 'My Fancy Title' README.md **/*.rb
Ignoring interception-0.5 because its extensions are not built.  Try: gem pristine interception --version 0.5
Parsing sources...
100% [15/15]  test/test_helper.rb

Generating Darkfish format into /Users/enebo/work/rails_prisme/doc...
Unhandled Java exception: IRReturnJump:<Static Type[1320248993]: local [text=set RAILS_ENV=production]:true>
Member

enebo commented Jun 2, 2016

system ~/work/rails_common develop 3503% jruby -S rdoc --main README.md --title 'My Fancy Title' README.md **/*.rb
jruby -S rdoc --main README.md --title 'My Fancy Title' README.md **/*.rb
Ignoring interception-0.5 because its extensions are not built.  Try: gem pristine interception --version 0.5
Parsing sources...
100% [ 7/ 7]  util/helpers.rb

Generating Darkfish format into /Users/enebo/work/rails_common/doc...

  Files:       7

  Classes:     0 ( 0 undocumented)
  Modules:     7 ( 7 undocumented)
  Constants:  16 (12 undocumented)
  Attributes:  1 ( 1 undocumented)
  Methods:    12 ( 8 undocumented)

  Total:      36 (28 undocumented)
   22.22% documented

  Elapsed: 2.9s

system ~/work/rails_common develop 3504% cd ../rails_prisme/
cd ../rails_prisme/
system ~/work/rails_prisme develop 3505% jruby -S rdoc --main README.md --title 'My Fancy Title' README.md **/*.rb
jruby -S rdoc --main README.md --title 'My Fancy Title' README.md **/*.rb
Ignoring interception-0.5 because its extensions are not built.  Try: gem pristine interception --version 0.5
Parsing sources...
100% [15/15]  test/test_helper.rb

Generating Darkfish format into /Users/enebo/work/rails_prisme/doc...
Unhandled Java exception: IRReturnJump:<Static Type[1320248993]: local [text=set RAILS_ENV=production]:true>
@cshupp1

This comment has been minimized.

Show comment
Hide comment
@cshupp1

cshupp1 Jun 2, 2016

You did it!!

cshupp1 commented Jun 2, 2016

You did it!!

@enebo

This comment has been minimized.

Show comment
Hide comment
@enebo

enebo Jun 2, 2016

Member

err saved that comment a bit early. Looks like rails_prisme itself contains something which triggers it. So not to remove stuff until I get which file it is...or hmm I bet rdoc has a debug mode...

Member

enebo commented Jun 2, 2016

err saved that comment a bit early. Looks like rails_prisme itself contains something which triggers it. So not to remove stuff until I get which file it is...or hmm I bet rdoc has a debug mode...

@enebo

This comment has been minimized.

Show comment
Hide comment
@enebo

enebo Jun 2, 2016

Member

Ok minimized this to an eval with BEGIN containing a return:

def foo
  eval("BEGIN {return true}")
end

foo
Member

enebo commented Jun 2, 2016

Ok minimized this to an eval with BEGIN containing a return:

def foo
  eval("BEGIN {return true}")
end

foo
@cshupp1

This comment has been minimized.

Show comment
Hide comment
@cshupp1

cshupp1 Jun 2, 2016

Wow. That shutdown my entire rails console.

irb(main):004:0> def foo
irb(main):005:1>   eval("BEGIN {return true}")
irb(main):006:1> end
=> :foo
irb(main):007:0> foo
LoadError: load error: rails/commands -- org.jruby.ir.runtime.IRReturnJump: null
  require at org/jruby/RubyKernel.java:939
    <top> at bin/rails:4
[ALWAYS][2016-06-02T17:21:15][/config/initializers/01_prisme_init.rb][41] Shutdown called!  Rails Prisme has been ruthlessly executed :-(
   (45.0ms)  SHUTDOWN
[ERROR][2016-06-02T17:21:15][/config/initializers/01_prisme_init.rb][45] H2 database was not shutdown, or was previously shutdown. ActiveRecord::JDBCError: org.h2.jdbc.JdbcSQLException: Database is already closed (to disable au
tomatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-181]: SHUTDOWN
[INFO][2016-06-02T17:21:15][/config/initializers/01_prisme_init.rb][46] If the message above states the database was closed then don't worry :-).

cshupp1 commented Jun 2, 2016

Wow. That shutdown my entire rails console.

irb(main):004:0> def foo
irb(main):005:1>   eval("BEGIN {return true}")
irb(main):006:1> end
=> :foo
irb(main):007:0> foo
LoadError: load error: rails/commands -- org.jruby.ir.runtime.IRReturnJump: null
  require at org/jruby/RubyKernel.java:939
    <top> at bin/rails:4
[ALWAYS][2016-06-02T17:21:15][/config/initializers/01_prisme_init.rb][41] Shutdown called!  Rails Prisme has been ruthlessly executed :-(
   (45.0ms)  SHUTDOWN
[ERROR][2016-06-02T17:21:15][/config/initializers/01_prisme_init.rb][45] H2 database was not shutdown, or was previously shutdown. ActiveRecord::JDBCError: org.h2.jdbc.JdbcSQLException: Database is already closed (to disable au
tomatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-181]: SHUTDOWN
[INFO][2016-06-02T17:21:15][/config/initializers/01_prisme_init.rb][46] If the message above states the database was closed then don't worry :-).
@enebo

This comment has been minimized.

Show comment
Hide comment
@enebo

enebo Jun 2, 2016

Member

ok reduced this a little more. BEGIN is not important:

def foo
  eval "return 1"
end

p foo

So the explicit return will be seen by method foo as a return value.

Member

enebo commented Jun 2, 2016

ok reduced this a little more. BEGIN is not important:

def foo
  eval "return 1"
end

p foo

So the explicit return will be seen by method foo as a return value.

@cshupp1

This comment has been minimized.

Show comment
Hide comment
@cshupp1

cshupp1 Jun 2, 2016

Which file of ours gave you this clue?

On Thu, Jun 2, 2016, 5:28 PM Thomas E Enebo notifications@github.com
wrote:

ok reduced this a little more. BEGIN is not important:

def foo
eval "return 1"end

p foo

So the explicit return will be seen by method foo as a return value.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#3713 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AFdGEu8ytGQJTlLieq8KJNU7moKPvhNwks5qH0sGgaJpZM4HqjfK
.

cshupp1 commented Jun 2, 2016

Which file of ours gave you this clue?

On Thu, Jun 2, 2016, 5:28 PM Thomas E Enebo notifications@github.com
wrote:

ok reduced this a little more. BEGIN is not important:

def foo
eval "return 1"end

p foo

So the explicit return will be seen by method foo as a return value.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#3713 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AFdGEu8ytGQJTlLieq8KJNU7moKPvhNwks5qH0sGgaJpZM4HqjfK
.

@enebo

This comment has been minimized.

Show comment
Hide comment
@enebo

enebo Jun 2, 2016

Member

@cshupp1 what is odd is it is in to_html.rb in rdoc:

  def parseable? text
    eval("BEGIN {return true}\n#{text}")
  rescue SyntaxError
    false
  end

I am testing the fix now. Basically, if we see an eval we have to add some extra handling just in case the eval throws a non-local return. Luckily, in IR, this is just setting a flag IRFlags.CAN_RECEIVE_NONLOCAL_RETURNS. Once we set that on a scope it will just put that exception plumbing in...

Member

enebo commented Jun 2, 2016

@cshupp1 what is odd is it is in to_html.rb in rdoc:

  def parseable? text
    eval("BEGIN {return true}\n#{text}")
  rescue SyntaxError
    false
  end

I am testing the fix now. Basically, if we see an eval we have to add some extra handling just in case the eval throws a non-local return. Luckily, in IR, this is just setting a flag IRFlags.CAN_RECEIVE_NONLOCAL_RETURNS. Once we set that on a scope it will just put that exception plumbing in...

@cshupp1

This comment has been minimized.

Show comment
Hide comment
@cshupp1

cshupp1 Jun 2, 2016

Thanks!

On Thu, Jun 2, 2016, 6:02 PM Thomas E Enebo notifications@github.com
wrote:

@cshupp1 https://github.com/cshupp1 what is odd is it is in to_html.rb
in rdoc:

def parseable? text
eval("BEGIN {return true}\n#{text}")
rescue SyntaxError
false
end

I am testing the fix now. Basically, if we see an eval we have to add some
extra handling just in case the eval throws a non-local return. Luckily, in
IR, this is just setting a flag IRFlags.CAN_RECEIVE_NONLOCAL_RETURNS. Once
we set that on a scope it will just put that exception plumbing in...


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#3713 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AFdGEsnhnzymdRhXoUmAaXGPgGIRDAspks5qH1L6gaJpZM4HqjfK
.

cshupp1 commented Jun 2, 2016

Thanks!

On Thu, Jun 2, 2016, 6:02 PM Thomas E Enebo notifications@github.com
wrote:

@cshupp1 https://github.com/cshupp1 what is odd is it is in to_html.rb
in rdoc:

def parseable? text
eval("BEGIN {return true}\n#{text}")
rescue SyntaxError
false
end

I am testing the fix now. Basically, if we see an eval we have to add some
extra handling just in case the eval throws a non-local return. Luckily, in
IR, this is just setting a flag IRFlags.CAN_RECEIVE_NONLOCAL_RETURNS. Once
we set that on a scope it will just put that exception plumbing in...


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#3713 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AFdGEsnhnzymdRhXoUmAaXGPgGIRDAspks5qH1L6gaJpZM4HqjfK
.

@dqdinh

This comment has been minimized.

Show comment
Hide comment
@dqdinh

dqdinh Jan 31, 2017

In JRuby 9.1.6.0 and 9.1.7.0, explicitly returning values will result in Unhandled Java exception: IRReturnJump that crashes irb.

For example

$ ruby -v
jruby 9.1.6.0 (2.3.1) 2016-11-09 0150a76 Java HotSpot(TM) 64-Bit Server VM 25.112-b16 on 1.8.0_112-b16 +jit [darwin-x86_64]
$ irb
irb(main):001:0> return
Unhandled Java exception: IRReturnJump:<Static Type[259219561]: local []:>
$

I understand that wrapping returns in a function definition will work:

irb(main):001:0> def foo; [1].each { |e| return e }; end
1

I also understand that wrapping returns in a block definition will return the expected MRI error:

irb(main):001:0> [1].each { |e| return e }
LocalJumpError: unexpected return
	from (irb):1:in `block in evaluate'
	from (irb):1:in `<eval>'
	from org/jruby/RubyKernel.java:998:in `eval'
	from org/jruby/RubyKernel.java:1299:in `loop'
	from org/jruby/RubyKernel.java:1118:in `catch'
	from org/jruby/RubyKernel.java:1118:in `catch'
	from /Users/ddinh/.rbenv/versions/jruby-9.1.6.0/bin/irb:13:in `<main>'

Why does an explicit return outside of a block or function definition cause IRB to crash?

dqdinh commented Jan 31, 2017

In JRuby 9.1.6.0 and 9.1.7.0, explicitly returning values will result in Unhandled Java exception: IRReturnJump that crashes irb.

For example

$ ruby -v
jruby 9.1.6.0 (2.3.1) 2016-11-09 0150a76 Java HotSpot(TM) 64-Bit Server VM 25.112-b16 on 1.8.0_112-b16 +jit [darwin-x86_64]
$ irb
irb(main):001:0> return
Unhandled Java exception: IRReturnJump:<Static Type[259219561]: local []:>
$

I understand that wrapping returns in a function definition will work:

irb(main):001:0> def foo; [1].each { |e| return e }; end
1

I also understand that wrapping returns in a block definition will return the expected MRI error:

irb(main):001:0> [1].each { |e| return e }
LocalJumpError: unexpected return
	from (irb):1:in `block in evaluate'
	from (irb):1:in `<eval>'
	from org/jruby/RubyKernel.java:998:in `eval'
	from org/jruby/RubyKernel.java:1299:in `loop'
	from org/jruby/RubyKernel.java:1118:in `catch'
	from org/jruby/RubyKernel.java:1118:in `catch'
	from /Users/ddinh/.rbenv/versions/jruby-9.1.6.0/bin/irb:13:in `<main>'

Why does an explicit return outside of a block or function definition cause IRB to crash?

@enebo

This comment has been minimized.

Show comment
Hide comment
@enebo

enebo Jan 31, 2017

Member

@dqdinh can you open a new issue for this (we are not handling some case of eval properly wrt eval). The error thrown is the same but the actual cause must be different since this issue is resolved.

Member

enebo commented Jan 31, 2017

@dqdinh can you open a new issue for this (we are not handling some case of eval properly wrt eval). The error thrown is the same but the actual cause must be different since this issue is resolved.

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