JDK-8223262 : [AOT] jaotc crashes with assert(!(((ThreadShadow*)__the_thread__)->has_pending_exception())) failed: Should not allocate with exception pending
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,13
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2019-05-02
  • Updated: 2020-04-27
  • Resolved: 2019-05-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 13
13 b20Fixed
Related Reports
Relates :  
Description
jaotc crashes with

jib > #
jib > # A fatal error has been detected by the Java Runtime Environment:
jib > #
jib > #  Internal Error (open/src/hotspot/share/gc/shared/memAllocator.cpp:147), pid=14878, tid=15307
jib > #  assert(!(((ThreadShadow*)__the_thread__)->has_pending_exception())) failed: Should not allocate with exception pending
jib > #
jib > # JRE version: Java(TM) SE Runtime Environment (13.0) (fastdebug build 13-internal+0-2019-05-01-2136356.ekaterina.pavlova.jdk.jdk)
jib > # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 13-internal+0-2019-05-01-2136356.ekaterina.pavlova.jdk.jdk, mixed mode, aot, sharing, tiered, jvmci, jvmci compiler, compressed oops, g1 gc, linux-amd64)
jib > # Problematic frame:
jib > # V  [libjvm.so+0x126991c]  MemAllocator::Allocation::verify_before()+0x4c

when trying to AOT some test classes.
Comments
Fix in graal-jvmci-8 repository: db758a9 Fri May 3 05:16:30 2019 -0700 Doug Simon [GR-15650] Add missing exception check in native code.
03-05-2019

Looks like we have an other bug caused by JDK-8220623 changes. Several JCK tests failed.
03-05-2019

ILW = Assert crashes VM due to pending exception (recent regression), several tests with AOT / Graal, no workaround (but disable AOT) = HMM = P2
03-05-2019

http://cr.openjdk.java.net/~kvn/8223262/webrev.00/
03-05-2019

src/hotspot/share/jvmci/jvmciCompilerToVM.cpp Fix in resolveTypeInPool(): @@ -559,3 +559,6 @@ if (resolved_klass->is_instance_klass()) { - InstanceKlass::cast(resolved_klass())->link_class_or_fail(THREAD); + bool linked = InstanceKlass::cast(resolved_klass())->link_class_or_fail(CHECK_NULL); + if (!linked) { + return NULL; + } }
03-05-2019

We don't clean pending exception for some reasons. I put print and exception cleaning and test is running. Exception is next which seems normal jck bad class file: ========== JVMCIEnv::get_jvmci_type Pending exception========== java.lang.VerifyError: Bad type on operand stack Exception Details: Location: javasoft/sqe/tests/lang/binc009/binc00901/binc00901_a.run(Ljava/io/PrintStream;)V @9: getfield Reason: Type 'javasoft/sqe/tests/lang/binc009/binc00901/Super' (current frame, stack[0]) is not assignable to 'javasoft/sqe/tests/lang/binc009/binc00901/Hyper' Current Frame: bci: @9 flags: { } locals: { 'java/io/PrintStream', 'javasoft/sqe/tests/lang/binc009/binc00901/Super' } stack: { 'javasoft/sqe/tests/lang/binc009/binc00901/Super' } Bytecode: 0000000: bb00 0259 b700 034c 2bb4 0004 1068 9f00 0000010: 0b2a 2bb4 0004 b600 05b1 Stackmap Table: append_frame(@25,Object[#15]) java.lang.VerifyError: Bad type on operand stack Exception Details: Location: javasoft/sqe/tests/lang/binc009/binc00901/binc00901_a.run(Ljava/io/PrintStream;)V @9: getfield Reason: Type 'javasoft/sqe/tests/lang/binc009/binc00901/Super' (current frame, stack[0]) is not assignable to 'javasoft/sqe/tests/lang/binc009/binc00901/Hyper' Current Frame: bci: @9 flags: { } locals: { 'java/io/PrintStream', 'javasoft/sqe/tests/lang/binc009/binc00901/Super' } stack: { 'javasoft/sqe/tests/lang/binc009/binc00901/Super' } Bytecode: 0000000: bb00 0259 b700 034c 2bb4 0004 1068 9f00 0000010: 0b2a 2bb4 0004 b600 05b1 Stackmap Table: append_frame(@25,Object[#15]) at jdk.vm.ci.hotspot.CompilerToVM.resolveTypeInPool(jdk.internal.vm.ci@13-internal/Native Method) at jdk.vm.ci.hotspot.HotSpotConstantPool.loadReferencedType(jdk.internal.vm.ci@13-internal/HotSpotConstantPool.java:736) at jdk.internal.reflect.GeneratedMethodAccessor1.invoke(java.base@13-internal/Unknown Source) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@13-internal/DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(java.base@13-internal/Method.java:567) at org.graalvm.compiler.hotspot.meta.HotSpotClassInitializationPlugin.loadReferencedType(jdk.internal.vm.compiler@13-internal/HotSpotClassInitializationPlugin.java:122) at org.graalvm.compiler.java.BytecodeParser.maybeEagerlyResolve(jdk.internal.vm.compiler@13-internal/BytecodeParser.java:4082) at org.graalvm.compiler.java.BytecodeParser.lookupMethod(jdk.internal.vm.compiler@13-internal/BytecodeParser.java:4034) at org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(jdk.internal.vm.compiler@13-internal/BytecodeParser.java:1453) at org.graalvm.compiler.java.BytecodeParser.processBytecode(jdk.internal.vm.compiler@13-internal/BytecodeParser.java:5020) at org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(jdk.internal.vm.compiler@13-internal/BytecodeParser.java:3184) at org.graalvm.compiler.java.BytecodeParser.processBlock(jdk.internal.vm.compiler@13-internal/BytecodeParser.java:2993) at org.graalvm.compiler.java.BytecodeParser.build(jdk.internal.vm.compiler@13-internal/BytecodeParser.java:891) at org.graalvm.compiler.java.BytecodeParser.buildRootMethod(jdk.internal.vm.compiler@13-internal/BytecodeParser.java:785) at org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(jdk.internal.vm.compiler@13-internal/GraphBuilderPhase.java:95) at org.graalvm.compiler.java.GraphBuilderPhase.run(jdk.internal.vm.compiler@13-internal/GraphBuilderPhase.java:59) at org.graalvm.compiler.java.GraphBuilderPhase.run(jdk.internal.vm.compiler@13-internal/GraphBuilderPhase.java:43) at org.graalvm.compiler.phases.BasePhase.apply(jdk.internal.vm.compiler@13-internal/BasePhase.java:197) at org.graalvm.compiler.phases.BasePhase.apply(jdk.internal.vm.compiler@13-internal/BasePhase.java:139) at org.graalvm.compiler.phases.PhaseSuite.run(jdk.internal.vm.compiler@13-internal/PhaseSuite.java:212) at org.graalvm.compiler.phases.BasePhase.apply(jdk.internal.vm.compiler@13-internal/BasePhase.java:197) at org.graalvm.compiler.phases.BasePhase.apply(jdk.internal.vm.compiler@13-internal/BasePhase.java:139) at jdk.tools.jaotc.AOTBackend.buildStructuredGraph(jdk.aot@13-internal/AOTBackend.java:120) at jdk.tools.jaotc.AOTBackend.compileMethod(jdk.aot@13-internal/AOTBackend.java:102) at jdk.tools.jaotc.AOTCompilationTask.run(jdk.aot@13-internal/AOTCompilationTask.java:122) at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@13-internal/ThreadPoolExecutor.java:1128) at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@13-internal/ThreadPoolExecutor.java:628) at java.lang.Thread.run(java.base@13-internal/Thread.java:835)
02-05-2019

No need. I got one.
02-05-2019

[~epavlova] Great! can you attach your hs_err file?
02-05-2019

[~kvn] hmm, I am not sure we can exclude big group of jck tests, but I will check. I will also provide instructions to reproduce the issue soon.
02-05-2019

[~epavlova] Please, file subtask to problem list failed test until we fix this problem. We should reduce CI noise.
02-05-2019

The regression is most probably introduced by https://bugs.openjdk.java.net/browse/JDK-8220623
02-05-2019