JDK-8363928 : Specifying AOTCacheOutput with a blank path causes the JVM to crash
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 25
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2025-07-19
  • Updated: 2025-08-18
  • Resolved: 2025-07-29
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 JDK 26
25.0.2Fixed 26 b09Fixed
Related Reports
Causes :  
Description
A DESCRIPTION OF THE PROBLEM :
Specifying AOTCacheOutput with a blank path causes the JVM to crash and generate a hs_err file.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the java command with an empty path for the AOT cache output file `java -XX:AOTCacheOutput=` 

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
When the `=` sign is omitted, the output is "Improperly specified VM option 'AOTCacheOutput'", which is what I would expect if the path is blank.
ACTUAL -
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffe2846e0f6, pid=9636, tid=9892
#
# JRE version:  (25.0+32) (build )
# Java VM: OpenJDK 64-Bit Server VM (25-ea+32-3464, mixed mode, sharing, tiered, compressed class ptrs, unknown gc, windows-amd64)
# Problematic frame:
# C  [VCRUNTIME140.dll+0xe0f6]


---------- BEGIN SOURCE ----------
None required.
---------- END SOURCE ----------


Comments
[jdk25u-fix-request] Approval Request from Aleksey Shipilëv Plugs the UX problem with new feature in JDK 25. Patch was added recently in mainline, but it is simple and has no bugtail. The risk is therefore low. The patch applies cleanly, new regression test fails without the fix, passes with it.
15-08-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk25u/pull/91 Date: 2025-08-15 16:49:36 +0000
15-08-2025

Changeset: ea754316 Branch: master Author: Calvin Cheung <ccheung@openjdk.org> Date: 2025-07-29 17:41:30 +0000 URL: https://git.openjdk.org/jdk/commit/ea754316fd6d691a701dfb4bc921ea8c92dc5dd4
29-07-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/26518 Date: 2025-07-28 22:23:36 +0000
28-07-2025

Suggested fix: diff --git a/src/hotspot/share/cds/cds_globals.hpp b/src/hotspot/share/cds/cds_globals.hpp index 730902207f0..f4094aec1ac 100644 --- a/src/hotspot/share/cds/cds_globals.hpp +++ b/src/hotspot/share/cds/cds_globals.hpp @@ -121,6 +121,7 @@ \ product(ccstr, AOTCacheOutput, nullptr, \ "Specifies the file name for writing the AOT cache") \ + constraint(AOTCacheOutputConstraintFunc, AtParse) \ \ product(bool, AOTInvokeDynamicLinking, false, DIAGNOSTIC, \ "AOT-link JVM_CONSTANT_InvokeDynamic entries in cached " \ diff --git a/src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.cpp b/src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.cpp index 9e0825339c9..abf3fe0dd04 100644 --- a/src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.cpp +++ b/src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.cpp @@ -39,6 +39,14 @@ JVMFlag::Error AOTCacheConstraintFunc(ccstr value, bool verbose) { return JVMFlag::SUCCESS; } +JVMFlag::Error AOTCacheOutputConstraintFunc(ccstr value, bool verbose) { + if (value == nullptr) { + JVMFlag::printError(verbose, "AOTCacheOutput cannot be empty\n"); + return JVMFlag::VIOLATES_CONSTRAINT; + } + return JVMFlag::SUCCESS; +} + JVMFlag::Error AOTConfigurationConstraintFunc(ccstr value, bool verbose) { if (value == nullptr) { JVMFlag::printError(verbose, "AOTConfiguration cannot be empty\n"); diff --git a/src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.hpp b/src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.hpp index 5ca28a73fb0..676e09efe73 100644 --- a/src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.hpp +++ b/src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.hpp @@ -35,6 +35,7 @@ #define RUNTIME_CONSTRAINTS(f) \ f(ccstr, AOTCacheConstraintFunc) \ + f(ccstr, AOTCacheOutputConstraintFunc) \ f(ccstr, AOTConfigurationConstraintFunc) \ f(ccstr, AOTModeConstraintFunc) \ f(int, ObjectAlignmentInBytesConstraintFunc) \ After the fix: $ java -XX:AOTCacheOutput= --version AOTCacheOutput cannot be empty Improperly specified VM option 'AOTCacheOutput=' Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.
25-07-2025

Debug build: $ java -XX:AOTCacheOutput= --version # assert(filename != nullptr) failed: must not have default value # Stack: [0x00007bc360900000,0x00007bc360a00000], sp=0x00007bc3609fb320, free space=1004k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0x1453230] NativeStackPrinter::print_stack(outputStream*, char*, int, unsigned char*&, bool, int)+0x70 (cdsConfig.cpp:499) V [libjvm.so+0x1817b9a] VMError::report(outputStream*, bool)+0x1b92 (vmError.cpp:960) V [libjvm.so+0x181b501] VMError::report_and_die(int, char const*, char const*, __va_list_tag*, Thread*, unsigned char*, void const*, void const*, char const*, int, unsigned long)+0x8ab (vmError.cpp:1846) V [libjvm.so+0xb759f0] report_vm_status_error(char const*, int, char const*, int, char const*)+0x0 (debug.cpp:195) V [libjvm.so+0x9c22f1] substitute_aot_filename(JVMFlagsEnum)+0xa1 (cdsConfig.cpp:499) V [libjvm.so+0x9c2552] CDSConfig::check_aotmode_record()+0x6a (cdsConfig.cpp:534) V [libjvm.so+0x9c204c] CDSConfig::check_aot_flags()+0x350 (cdsConfig.cpp:464) V [libjvm.so+0x9c29b1] CDSConfig::check_vm_args_consistency(bool, bool)+0x6f (cdsConfig.cpp:628) V [libjvm.so+0x7756f2] Arguments::check_vm_args_consistency()+0x26 (arguments.cpp:1794) V [libjvm.so+0x77923f] Arguments::finalize_vm_init_args()+0x21f (arguments.cpp:2951) V [libjvm.so+0x775e0e] Arguments::parse_vm_init_args(GrowableArrayCHeap<VMInitArgsGroup, (MemTag)19>*)+0xf2 (arguments.cpp:1990) V [libjvm.so+0x77a8ba] Arguments::parse(JavaVMInitArgs const*)+0x69a (arguments.cpp:3640) V [libjvm.so+0x177d4a3] Threads::create_vm(JavaVMInitArgs*, bool*)+0xc7 (threads.cpp:485) V [libjvm.so+0x1082d98] JNI_CreateJavaVM_inner(JavaVM_**, void**, void*)+0x93 (jni.cpp:3589) V [libjvm.so+0x10831ce] JNI_CreateJavaVM+0x32 (jni.cpp:3680) C [libjli.so+0x3cff] JavaMain+0x8f C [libjli.so+0x7d29] ThreadJavaMain+0x9
23-07-2025

Impact -> M (Somewhere in-between the extremes) Likelihood -> M (Somewhere in-between the extremes) Workaround -> M (Somewhere in-between the extremes) Priority -> P3
23-07-2025

The observations on Windows 11: JDK 25ea+25: Passed. JDK 25ea+26: Failed, JVM crashed. Ubuntu also has the same results.
23-07-2025