Skip to content
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

jruby 9.4.1.0 irb fails with a java backtrace when @ #7689

Closed
suetanvil opened this issue Feb 25, 2023 · 3 comments
Closed

jruby 9.4.1.0 irb fails with a java backtrace when @ #7689

suetanvil opened this issue Feb 25, 2023 · 3 comments

Comments

@suetanvil
Copy link

Environment information:

  • Ubuntu 20.04 (Linux mica 5.15.0-60-generic #66~20.04.1-Ubuntu SMP Wed Jan 25 09:41:30 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux)
  • jruby 9.4.1.0 (3.1.0) 2023-02-07 237d5fa5f4 OpenJDK 64-Bit Server VM 16.0.1+9-Ubuntu-120.04 on 16.0.1+9-Ubuntu-120.04 +jit [x86_64-linux]
    ** (also on jruby 9.4.0.0 (3.1.0) 2022-11-23 95c0ec159f OpenJDK 64-Bit Server VM 16.0.1+9-Ubuntu-120.04 on 16.0.1+9-Ubuntu-120.04 +jit [x86_64-linux])
  • openjdk version "16.0.1" 2021-04-20
  • Installed via rbenv; no gems installed other than the defaults.
    ** (Well, for jruby 9.4.0.0; the 9.4.1.0 has a number of gems, but that's probably not relevant.)

Steps to reproduce:

  1. Start irb with or without --noautocomplete
  2. Type @ at the prompt. irb should fail with a JVM backtrace. This seems to happen regardless of where the @ is typed, outside of a string literal or comment.

Other details:

  • jruby -e 'x = @y' seems to work as expected.
  • The Ruby code used by the Emacs enh-ruby-mode package also exhibits this behaviour.

The Backtrace

Here's a partial backtrace:

[...]
INTERPRET_METHOD at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:201
call at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:188
call at org/jruby/internal/runtime/methods/DynamicMethod.java:220
cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:495
call at org/jruby/runtime/callsite/CachingCallSite.java:244 [0/279]
processCall at org/jruby/ir/interpreter/InterpreterEngine.java:318
interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:66
interpret at org/jruby/ir/interpreter/InterpreterEngine.java:82
INTERPRET_METHOD at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:201
call at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:188
call at org/jruby/internal/runtime/methods/DynamicMethod.java:220
cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:495
call at org/jruby/runtime/callsite/CachingCallSite.java:244
processCall at org/jruby/ir/interpreter/InterpreterEngine.java:318
interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:66
INTERPRET_ROOT at org/jruby/ir/interpreter/Interpreter.java:96
execute at org/jruby/ir/interpreter/Interpreter.java:81
execute at org/jruby/ir/interpreter/Interpreter.java:30
execute at org/jruby/ir/IRTranslator.java:42
runInterpreter at org/jruby/Ruby.java:1290
loadFile at org/jruby/Ruby.java:2964
load at org/jruby/runtime/load/LibrarySearcher.java:925
load at org/jruby/runtime/load/LibrarySearcher.java:883
load at org/jruby/runtime/load/LoadService.java:380
loadCommon at org/jruby/RubyKernel.java:1121
load at org/jruby/RubyKernel.java:1091
call at org/jruby/RubyKernel$INVOKER$s$load.gen:-1
call at org/jruby/internal/runtime/methods/JavaMethod.java:422
cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:495
call at org/jruby/runtime/callsite/CachingCallSite.java:244
fcall at org/jruby/runtime/callsite/CachingCallSite.java:248
invokeOther11:load at home/chris/$_dot_rbenv/versions/jruby_minus_9_dot_4_dot_1_dot_0/bin//home/ch
ris/.rbenv/versions/jruby-9.4.1.0/bin/irb:23
RUBY$script at home/chris/$_dot_rbenv/versions/jruby_minus_9_dot_4_dot_1_dot_0/bin//home/ch
ris/.rbenv/versions/jruby-9.4.1.0/bin/irb:23
run at home/chris/$_dot_rbenv/versions/jruby_minus_9_dot_4_dot_1_dot_0/bin//home/ch
ris/.rbenv/versions/jruby-9.4.1.0/bin/irb:-1
invokeWithArguments at java/lang/invoke/MethodHandle.java:732
load at org/jruby/ir/Compiler.java:114
runScript at org/jruby/Ruby.java:1277
runNormally at org/jruby/Ruby.java:1194
runNormally at org/jruby/Ruby.java:1176
runNormally at org/jruby/Ruby.java:1212
runFromMain at org/jruby/Ruby.java:991
doRunFromMain at org/jruby/Main.java:398
internalRun at org/jruby/Main.java:282
run at org/jruby/Main.java:227
main at org/jruby/Main.java:199

The section between INTERPRET_METHOD sequences repeats, so I'm guessing this is an infinite recursion. However, I'm also attaching the full backtrace.

@suetanvil
Copy link
Author

backtrace.txt.gz

Here's the full backtrace attached. Note that I had to copy-and-paste it into an editor in several steps so missing or duplicated lines are possible.

@headius
Copy link
Member

headius commented Feb 28, 2023

This seems to be working on master, which will be 9.4.2:

irb(main):001:0> @
org/jruby/RubyKernel.java:1143:in `eval': (irb):1: `@' without identifiers is not allowed as an instance variable name (SyntaxError)
	from org/jruby/RubyKernel.java:1586:in `loop'
	from org/jruby/RubyKernel.java:1292:in `catch'
	from org/jruby/RubyKernel.java:1292:in `catch'
	from /home/headius/work/jruby/lib/ruby/gems/shared/gems/irb-1.4.2/exe/irb:11:in `<main>'
	from org/jruby/RubyKernel.java:1091:in `load'
	from /home/headius/work/jruby/bin/irb:23:in `<main>'

Probably some parser/ripper fixes by @enebo?

@headius headius added this to the JRuby 9.4.2.0 milestone Feb 28, 2023
@headius
Copy link
Member

headius commented Feb 28, 2023

Fixed already for #7639. Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants