Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8149727

intermittent NPE in Nashorn nightly builds

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2
    • 9
    • 9
    • hotspot
    • None

    Description

      Since Feb 8, 2016, the Nashorn nightly builds suffer from an intermittent NPE problem occurring in test262parallel execution. The error manifests as follows:

           [java] java.lang.AssertionError: Failed generating bytecode for test/script/external/test262/test/harness/sta.js:-1
           [java] at jdk.nashorn.internal.codegen.CompilationPhase$BytecodeGenerationPhase.transform(CompilationPhase.java:436)
           [java] at jdk.nashorn.internal.codegen.CompilationPhase.apply(CompilationPhase.java:630)
           [java] at jdk.nashorn.internal.codegen.Compiler.compile(Compiler.java:656)
           [java] at jdk.nashorn.internal.runtime.RecompilableScriptFunctionData.compileTypeSpecialization(RecompilableScriptFunctionData.java:717)
           [java] at jdk.nashorn.internal.runtime.RecompilableScriptFunctionData.getBest(RecompilableScriptFunctionData.java:897)
           [java] at jdk.nashorn.internal.runtime.ScriptFunctionData.getBest(ScriptFunctionData.java:392)
           [java] at jdk.nashorn.internal.runtime.ScriptFunctionData.getBestInvoker(ScriptFunctionData.java:254)
           [java] at jdk.nashorn.internal.runtime.ScriptFunction.findCallMethod(ScriptFunction.java:915)
           [java] at jdk.nashorn.internal.runtime.ScriptObject.lookup(ScriptObject.java:1862)
           [java] at jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(NashornLinker.java:102)
           [java] at jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(NashornLinker.java:94)
           [java] at jdk.dynalink.linker.support.CompositeTypeBasedGuardingDynamicLinker.getGuardedInvocation(CompositeTypeBasedGuardingDynamicLinker.java:184)
           [java] at jdk.dynalink.linker.support.CompositeGuardingDynamicLinker.getGuardedInvocation(CompositeGuardingDynamicLinker.java:132)
           [java] at jdk.dynalink.LinkerServicesImpl.getGuardedInvocation(LinkerServicesImpl.java:146)
           [java] at jdk.dynalink.DynamicLinker.relink(DynamicLinker.java:262)
           [java] at jdk.nashorn.internal.scripts.Script$Recompilation$466030$18490D$sta.DaylightSavingTA(test/script/external/test262/test/harness/sta.js:651)
           [java] at jdk.nashorn.internal.scripts.Script$Recompilation$465985$sta$cu1$restOf.:program(test/script/external/test262/test/harness/sta.js:566)
           [java] at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:654)
           [java] at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:511)
           [java] at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
           [java] at jdk.nashorn.internal.test.framework.SharedContextEvaluator.run(SharedContextEvaluator.java:135)
           [java] at jdk.nashorn.internal.test.framework.AbstractScriptRunnable.evaluateScript(AbstractScriptRunnable.java:200)
           [java] at jdk.nashorn.internal.test.framework.ParallelTestRunner$ScriptRunnable.execute(ParallelTestRunner.java:202)
           [java] at jdk.nashorn.internal.test.framework.AbstractScriptRunnable.runTest(AbstractScriptRunnable.java:132)
           [java] at jdk.nashorn.internal.test.framework.ParallelTestRunner$ScriptRunnable.call(ParallelTestRunner.java:281)
           [java] at jdk.nashorn.internal.test.framework.ParallelTestRunner$ScriptRunnable.call(ParallelTestRunner.java:124)
           [java] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           [java] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1158)
           [java] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:632)
           [java] at java.lang.Thread.run(Thread.java:804)
           [java] Caused by: java.lang.NullPointerException
           [java] at jdk.internal.org.objectweb.asm.Type.getMethodDescriptor(Type.java:678)
           [java] at jdk.nashorn.internal.codegen.types.Type.getMethodDescriptor(Type.java:207)
           [java] at jdk.nashorn.internal.codegen.FunctionSignature.<init>(FunctionSignature.java:137)
           [java] at jdk.nashorn.internal.codegen.FunctionSignature.<init>(FunctionSignature.java:67)
           [java] at jdk.nashorn.internal.codegen.FunctionSignature.<init>(FunctionSignature.java:154)
           [java] at jdk.nashorn.internal.codegen.ClassEmitter.method(ClassEmitter.java:551)
           [java] at jdk.nashorn.internal.codegen.CodeGenerator.enterFunctionNode(CodeGenerator.java:2100)
           [java] at jdk.nashorn.internal.ir.FunctionNode.accept(FunctionNode.java:342)
           [java] at jdk.nashorn.internal.ir.LexicalContextNode$Acceptor.accept(LexicalContextNode.java:57)
           [java] at jdk.nashorn.internal.ir.LexicalContextExpression.accept(LexicalContextExpression.java:47)
           [java] at jdk.nashorn.internal.ir.FunctionNode.accept(FunctionNode.java:56)
           [java] at jdk.nashorn.internal.codegen.CompilationPhase.transformFunction(CompilationPhase.java:634)
           [java] at jdk.nashorn.internal.codegen.CompilationPhase.access$100(CompilationPhase.java:55)
           [java] at jdk.nashorn.internal.codegen.CompilationPhase$BytecodeGenerationPhase.transform(CompilationPhase.java:423)
           [java] ... 29 more

      One of the entries in the itypes argument passed to ASM's getMethodDescriptor is null when it shouldn't be. Indeed, the entries in the array are initialised either from "new Type(...)" calls, or from static final fields.

      Changing the implementation of Nashorn's Type.getMethodDescriptor to include an additional check (see below) leads to the same stack trace (with the line number changing from 207 to 209), so the value is not null in the check, but appears to be null in the called method.

          public static String getMethodDescriptor(final Type returnType, final Type... types) {
              final jdk.internal.org.objectweb.asm.Type[] itypes = new jdk.internal.org.objectweb.asm.Type[types.length];
              for (int i = 0; i < types.length; i++) {
                  if ((itypes[i] = types[i].getInternalType()) == null) {
                      throw new AssertionError("EEK " + itypes[i]);
                  }
              }
              return jdk.internal.org.objectweb.asm.Type.getMethodDescriptor(returnType.getInternalType(), itypes);
          }

      A full log of a failing test run is attached. Note that the test run either succeeds, or fails with many instances of the same error.

      Attachments

        Issue Links

          Activity

            People

              thartmann Tobias Hartmann
              mhaupt Michael Haupt
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: