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

AOT compile of empty module results in NullPointerException #3452

Closed
danshep opened this Issue Nov 10, 2015 · 4 comments

Comments

Projects
None yet
3 participants
@danshep
Copy link

commented Nov 10, 2015

test.rb:

module Xsg
end
d:\temp>jrubyc test.rb && jruby -e "require 'jruby'; JRuby.runtime.debug = true; require './test.class'"
java.lang.NullPointerException
        at org.jruby.runtime.scope.OneVarDynamicScope.getValue(OneVarDynamicScope.java:53)
        at org.jruby.ir.interpreter.InterpreterEngine.retrieveOp(InterpreterEngine.java:552)
        at org.jruby.ir.interpreter.InterpreterEngine.processReturnOp(InterpreterEngine.java:380)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:80)
        at org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:77)
        at org.jruby.internal.runtime.methods.InterpretedIRBodyMethod.interpretWithBacktrace(InterpretedIRBodyMethod.java:72)
        at org.jruby.internal.runtime.methods.InterpretedIRBodyMethod.INTERPRET_MODULE(InterpretedIRBodyMethod.java:62)
        at org.jruby.internal.runtime.methods.InterpretedIRBodyMethod.callInternal(InterpretedIRBodyMethod.java:47)
        at org.jruby.internal.runtime.methods.InterpretedIRBodyMethod.call(InterpretedIRBodyMethod.java:37)
        at org.jruby.ir.instructions.ProcessModuleBodyInstr.interpret(ProcessModuleBodyInstr.java:56)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.processOtherOp(StartupInterpreterEngine.java:191)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:115)
        at org.jruby.ir.interpreter.Interpreter.INTERPRET_ROOT(Interpreter.java:102)
        at org.jruby.ir.interpreter.Interpreter.execute(Interpreter.java:89)
        at org.jruby.ir.interpreter.Interpreter.execute(Interpreter.java:32)
        at org.jruby.ir.IRTranslator.execute(IRTranslator.java:42)
        at org.jruby.Ruby.runInterpreter(Ruby.java:837)
        at org.jruby.Ruby.loadScope(Ruby.java:2921)
        at org.jruby.runtime.load.LibrarySearcher$ClassResourceLibrary.load(LibrarySearcher.java:264)
        at org.jruby.runtime.load.LibrarySearcher$FoundLibrary.load(LibrarySearcher.java:35)
        at org.jruby.runtime.load.LoadService.tryLoadingLibraryOrScript(LoadService.java:896)
        at org.jruby.runtime.load.LoadService.smartLoadInternal(LoadService.java:541)
        at org.jruby.runtime.load.LoadService.requireCommon(LoadService.java:426)
        at org.jruby.runtime.load.LoadService.require(LoadService.java:392)
        at org.jruby.RubyKernel.requireCommon(RubyKernel.java:946)
        at org.jruby.RubyKernel.require19(RubyKernel.java:939)
        at org.jruby.RubyKernel$INVOKER$s$1$0$require19.call(RubyKernel$INVOKER$s$1$0$require19.gen)
        at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneOrNBlock.call(JavaMethod.java:380)
        at org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:61)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:161)
        at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:290)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:77)
        at org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:83)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:197)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:183)
        at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:197)
        at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:313)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:163)
        at DashE.invokeOther5:require(-e)
        at DashE.RUBY$script(-e:1)
        at java.lang.invoke.MethodHandle.invokeWithArguments(Unknown Source)
        at org.jruby.ir.Compiler$1.load(Compiler.java:111)
        at org.jruby.Ruby.runScript(Ruby.java:821)
        at org.jruby.Ruby.runScript(Ruby.java:813)
        at org.jruby.Ruby.runNormally(Ruby.java:751)
        at org.jruby.Ruby.runFromMain(Ruby.java:573)
        at org.jruby.Main.doRunFromMain(Main.java:409)
        at org.jruby.Main.internalRun(Main.java:304)
        at org.jruby.Main.run(Main.java:233)
        at org.jruby.Main.main(Main.java:200)
Exception `LoadError' at org/jruby/RubyKernel.java:939 - load error: ./test.class -- java.lang.NullPointerException: null
LoadError: load error: ./test.class -- java.lang.NullPointerException: null
  require at org/jruby/RubyKernel.java:939
  require at C:/jruby-9.0.3.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:54
    <top> at -e:1

@danshep

This comment has been minimized.

Copy link
Author

commented Nov 10, 2015

Error reproduced in jruby 9.0.0.3 running on windows with java 1.8.0_65 and centos running OpenJDK Runtime Environment (rhel-2.6.2.2.el6_7-x86_64 u91-b00).

@thepoho

This comment has been minimized.

Copy link

commented Dec 21, 2015

I also get this issue with jruby 9.0.4.0 on ubuntu 14.04. Can recreate using the above steps

@enebo enebo added this to the JRuby 9.0.5.0 milestone Dec 21, 2015

@enebo enebo added the ir label Dec 21, 2015

@enebo

This comment has been minimized.

Copy link
Member

commented Dec 21, 2015

Ah someone is doing something we did not anticipate! :)

Manually modifying runtime to toggle debug state is a condition we should handle. This is just an oversight.

@danshep

This comment has been minimized.

Copy link
Author

commented Dec 21, 2015

Changing the debug flag isn't the issue - I get a NullPointerException without the debug flag - I just added that for more detail.

[vagrant@vagrant-centos65 jruby-test]$ jrubyc test.rb && jruby -e "require './test.class'"
LoadError: load error: ./test.class -- java.lang.NullPointerException: null
  require at org/jruby/RubyKernel.java:939
  require at /usr/local/rbenv/versions/jruby-9.0.4.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:54
    <top> at -e:1

@subbuss subbuss closed this in 16824ff Dec 21, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.