NPE loading Rails console #1007

Closed
nirvdrum opened this Issue Sep 12, 2013 · 3 comments

Projects

None yet

2 participants

@nirvdrum
Contributor

I haven't gotten a reduced test case yet, but just going from JRuby 1.7.4 to 1.7.5-dev (indy disabled in both), I'm seeing an NPE loading a Rails console. The trace looks like:

org.jruby.util.io.EncodingUtils.econvOpenOpts(EncodingUtils.java:553)
org.jruby.RubyIO.makeReadConversion(RubyIO.java:5118)
org.jruby.RubyIO.readAll(RubyIO.java:3211)
org.jruby.RubyIO.read(RubyIO.java:3028)
org.jruby.RubyIO$INVOKER$i$read.call(RubyIO$INVOKER$i$read.gen)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:136)
org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:60)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:206)
org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:157)
org.jruby.runtime.Interpreted19Block.yieldSpecific(Interpreted19Block.java:135)
org.jruby.runtime.Block.yieldSpecific(Block.java:120)
org.jruby.ast.YieldOneNode.interpret(YieldOneNode.java:35)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.ReturnNode.interpret(ReturnNode.java:92)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96)
org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.IfNode.interpret(IfNode.java:116)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:204)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:206)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:336)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:179)
org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:188)
org.jruby.ast.CallOneArgBlockNode.interpret(CallOneArgBlockNode.java:60)
org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:225)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:214)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:346)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:204)
org.jruby.ast.FCallTwoArgNode.interpret(FCallTwoArgNode.java:38)
org.jruby.ast.ReturnNode.interpret(ReturnNode.java:92)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.IfNode.interpret(IfNode.java:116)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:198)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:139)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:182)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:136)
org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:60)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:198)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:139)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:182)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:136)
org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:60)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.RescueNode.executeBody(RescueNode.java:221)
org.jruby.ast.RescueNode.interpret(RescueNode.java:116)
org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:139)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:182)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:136)
org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:60)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:198)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.ast.WhenOneArgNode.whenSlowTest(WhenOneArgNode.java:36)
org.jruby.ast.WhenOneArgNode.when(WhenOneArgNode.java:46)
org.jruby.ast.CaseNode.interpret(CaseNode.java:132)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.ast.RootNode.interpret(RootNode.java:129)
org.jruby.evaluator.ASTInterpreter.INTERPRET_ROOT(ASTInterpreter.java:121)
org.jruby.Ruby.runInterpreter(Ruby.java:841)
org.jruby.Ruby.loadFile(Ruby.java:2726)
org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:66)
org.jruby.runtime.load.LoadService.tryLoadingLibraryOrScript(LoadService.java:958)
org.jruby.runtime.load.LoadService.smartLoadInternal(LoadService.java:573)
org.jruby.runtime.load.LoadService.requireCommon(LoadService.java:457)
org.jruby.runtime.load.LoadService.require(LoadService.java:421)
org.jruby.RubyKernel.requireCommon(RubyKernel.java:1088)
org.jruby.RubyKernel.require19(RubyKernel.java:1082)
org.jruby.RubyKernel$INVOKER$s$1$0$require19.call(RubyKernel$INVOKER$s$1$0$require19.gen)
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneOrNBlock.call(JavaMethod.java:350)
org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:61)
org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:61)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
$_dot_.script.rails.__file__(./script/rails:6)
$_dot_.script.rails.load(./script/rails)
org.jruby.Ruby.runScript(Ruby.java:814)
org.jruby.Ruby.runScript(Ruby.java:807)
org.jruby.Ruby.runNormally(Ruby.java:676)
org.jruby.Ruby.runFromMain(Ruby.java:525)
org.jruby.Main.doRunFromMain(Main.java:395)
org.jruby.Main.internalRun(Main.java:290)
org.jruby.Main.run(Main.java:217)
org.jruby.Main.main(Main.java:197)
@headius
Member
headius commented Sep 12, 2013

Ok thanks. Looks like it's in the new encoding logic for 1.7.5. Investigating.

@headius headius closed this in 4732420 Sep 12, 2013
@headius
Member
headius commented Sep 12, 2013

@nirvdrum I added a null check at the line in question, but I'd like to know who is setting this value to null. Can you apply this patch and tell me what output you get?

https://gist.github.com/6535720

Perhaps pass -X+C in a second run if you see any thread dumps.

A second fix I'm about to commit fixes the one place I could see that I was incorrectly allowing ecopts to be null. The patch in this comment logs if any other code is setting ecopts to null. Hopefully you will see no logging output at all.

@nirvdrum
Contributor

It looks fixed. Thanks.

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