JDK-8352092 : -XX:AOTMode=record crashes with InstanceKlass in allocated state
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 25
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2025-03-14
  • Updated: 2025-03-31
  • Resolved: 2025-03-31
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 25
25 masterFixed
Related Reports
Causes :  
Duplicate :  
Description
Creating AOT configuration file as part of running vm/jni/DefineClass/dfcl001/dfcl00107m1/dfcl00107m1.html jck test in aot mode
crashes with

#
# JRE version: Java(TM) SE Runtime Environment (25.0) (fastdebug build 25-internal-LTS-2025-03-14-1707570.katya...)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 25-internal-LTS-2025-03-14-1707570.katya..., mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xf16b47]  InstanceKlass::can_be_verified_at_dumptime() const+0xa7

---------------  S U M M A R Y ------------

Command Line: --enable-preview -Djava.awt.headless=true -XX:AOTMode=record -Xlog:class+path=info -XX:AOTConfiguration=/home/katya/work/JavaSE/Hotspot/bugs/jdk24/pit-jep483/jck/results_training/vm/jni/DefineClass/dfcl001/dfcl00107m1/dfcl00107m1.aotconf --enable-native-access=ALL-UNNAMED -Djava.security.policy=/home/katya/jck/25/b01/JCK-runtime-preinstalled-jars-25/lib/jck.policy javasoft.sqe.tests.vm.jni.dfcl001.dfcl00107m1.dfcl00107m1 -platform.nativeCodeSupported true

Host: olegbox, Intel(R) Xeon(R) CPU E5-2630 0 @ 2.30GHz, 24 cores, 15G, Ubuntu 16.04.6 LTS
Time: Fri Mar 14 14:15:07 2025 PDT elapsed time: 1.068363 seconds (0d 0h 0m 1s)

---------------  T H R E A D  ---------------

Current thread (0x00007fed3c02ed80):  JavaThread "main"             [_thread_in_vm, id=24349, stack(0x00007fed44e74000,0x00007fed44f75000) (1028K)]

Stack: [0x00007fed44e74000,0x00007fed44f75000],  sp=0x00007fed44f71b90,  free space=1014k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xf16b47]  InstanceKlass::can_be_verified_at_dumptime() const+0xa7  (array.hpp:107)
V  [libjvm.so+0x150bce6]  MetaspaceShared::link_shared_classes(JavaThread*)+0x2e6  (metaspaceShared.cpp:777)
V  [libjvm.so+0x150cca6]  MetaspaceShared::preload_and_dump_impl(StaticArchiveBuilder&, JavaThread*)+0x1f6  (metaspaceShared.cpp:1061)
V  [libjvm.so+0x150d37a]  MetaspaceShared::preload_and_dump(JavaThread*)+0xaa  (metaspaceShared.cpp:873)
V  [libjvm.so+0xf7ebb9]  before_exit(JavaThread*, bool)+0x199  (java.cpp:543)
V  [libjvm.so+0x110f51c]  JVM_Halt+0x9c  (jvm.cpp:446)
j  java.lang.Shutdown.halt0(I)V+0 java.base@25-internal
j  java.lang.Shutdown.halt(I)V+7 java.base@25-internal
j  java.lang.Shutdown.exit(I)V+16 java.base@25-internal
j  java.lang.Runtime.exit(I)V+1 java.base@25-internal
j  java.lang.System.exit(I)V+4 java.base@25-internal
j  javasoft.sqe.tests.vm.jni.dfcl001.dfcl00107m1.dfcl00107m1.main([Ljava/lang/String;)V+10
v  ~StubRoutines::call_stub 0x00007fed2bc6dd01
V  [libjvm.so+0xf8446c]  JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*)+0x4ac  (javaCalls.cpp:415)
V  [libjvm.so+0x10c7150]  jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, JavaThread*) [clone .constprop.1]+0x360  (jni.cpp:883)
V  [libjvm.so+0x10ca853]  jni_CallStaticVoidMethod+0x193  (jni.cpp:1712)
C  [libjli.so+0x39ca]  invokeStaticMainWithArgs+0x4a  (java.c:392)
C  [libjli.so+0x4a89]  JavaMain+0xee9  (java.c:640)
C  [libjli.so+0x79e9]  ThreadJavaMain+0x9  (java_md.c:649)
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  java.lang.Shutdown.halt0(I)V+0 java.base@25-internal
j  java.lang.Shutdown.halt(I)V+7 java.base@25-internal
j  java.lang.Shutdown.exit(I)V+16 java.base@25-internal
j  java.lang.Runtime.exit(I)V+1 java.base@25-internal
j  java.lang.System.exit(I)V+4 java.base@25-internal
j  javasoft.sqe.tests.vm.jni.dfcl001.dfcl00107m1.dfcl00107m1.main([Ljava/lang/String;)V+10
v  ~StubRoutines::call_stub 0x00007fed2bc6dd01

siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000000


The issue exists in both jdk master and premain workspaces.

Comments
Changeset: a83760a6 Branch: master Author: Ioi Lam <iklam@openjdk.org> Date: 2025-03-31 23:35:48 +0000 URL: https://git.openjdk.org/jdk/commit/a83760a6f204837b737b82801ee9eca2988317cf
31-03-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/24172 Date: 2025-03-22 04:39:40 +0000
22-03-2025

The crashes happens when the application uses JNI_DefineClass() to define a class with the name "java/foo/ABC". This class will be parsed by the ClassListParser and entered into the ClassLoaderData, but fails to be inserted into the SystemDictionary. So the class (an InstanceKlass) remains in the "allocated" state. It's InstanceKlass::interfaces() returns nullptr. This error condition can be reproduced only with JNI_DefineClass(). Attempts by Java code to define classes in prohibited packages will be blocked before ClassListParser is called.
22-03-2025

ILW=HML=P2
18-03-2025

The issue is 100% reproduced at least on linux with fastdebug build. The issue was introduced in jdk25b12. No issue in jdk25b11.
14-03-2025