Steps to reproduce:
1. Create a CDS archive using a classpath:
$ java -Xshare:dump -Xlog:cds=info -XX:SharedArchiveFile=testcds.jsa -XX:ExtraSharedClassListFile=classlist -cp hello.jar HelloWorld
2. Try to use it without specifying any classpath:
$ java -Xshare:on -XX:SharedArchiveFile=testcds.jsa -Xlog:cds=info HelloWorld
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc: SuppressErrorAt=/filemap.cpp:905
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (/work/jdk/src/hotspot/share/cds/filemap.cpp:905), pid=526339, tid=526340
# assert(strlen(rp_array->at(i)) > (size_t)runtime_prefix_len) failed: sanity
#
# JRE version: (21.0) (fastdebug build )
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 21-internal-adhoc.asmehra.jdk, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0xc17085] FileMapInfo::check_paths(int, int, GrowableArray<char const*>*, unsigned int, unsigned int) [clone .constprop.159]+0x305
#
# Core dump will be written. Default location: /work/jdk/core.526339
#
# An error report file with more information is saved as:
# /work/jdk/hs_err_pid526339.log
#
#
Aborted (core dumped)
Assertion failure happens at jdk/src/hotspot/share/cds/filemap.cpp:905
assert(strlen(rp_array->at(i)) > (size_t)runtime_prefix_len)
Reason for the failure is runtime_prefix_len is incorrectly computed to be 1 by longest_common_app_classpath_prefix_len() but it should be 0 when the classpath is not specified.
1. Create a CDS archive using a classpath:
$ java -Xshare:dump -Xlog:cds=info -XX:SharedArchiveFile=testcds.jsa -XX:ExtraSharedClassListFile=classlist -cp hello.jar HelloWorld
2. Try to use it without specifying any classpath:
$ java -Xshare:on -XX:SharedArchiveFile=testcds.jsa -Xlog:cds=info HelloWorld
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc: SuppressErrorAt=/filemap.cpp:905
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (/work/jdk/src/hotspot/share/cds/filemap.cpp:905), pid=526339, tid=526340
# assert(strlen(rp_array->at(i)) > (size_t)runtime_prefix_len) failed: sanity
#
# JRE version: (21.0) (fastdebug build )
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 21-internal-adhoc.asmehra.jdk, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0xc17085] FileMapInfo::check_paths(int, int, GrowableArray<char const*>*, unsigned int, unsigned int) [clone .constprop.159]+0x305
#
# Core dump will be written. Default location: /work/jdk/core.526339
#
# An error report file with more information is saved as:
# /work/jdk/hs_err_pid526339.log
#
#
Aborted (core dumped)
Assertion failure happens at jdk/src/hotspot/share/cds/filemap.cpp:905
assert(strlen(rp_array->at(i)) > (size_t)runtime_prefix_len)
Reason for the failure is runtime_prefix_len is incorrectly computed to be 1 by longest_common_app_classpath_prefix_len() but it should be 0 when the classpath is not specified.
- relates to
-
JDK-8299699 Test runtime/cds/appcds/WrongClasspath.java fails after JDK-8299329
-
- Resolved
-