JDK-8228407 : JVM crashes with shared archive file mismatch
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 13,14
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2019-07-18
  • Updated: 2020-04-17
  • Resolved: 2019-07-25
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 11 JDK 13 JDK 14
11.0.8Fixed 13 b32Fixed 14Fixed
Related Reports
Relates :  
Relates :  
Description
When I build the whole jdk and then just the jvm with fastdebug like:

#!/bin/csh
# build whole JDK first with jib, then do this for incremental.
# might need to adjust linux-x64 directory if using configure -p for
# multiple configurations
if (! $?JAVA_HOME) then
  echo "JAVA_HOME must be set"
  exit 1
endif

make hotspot LOG=info
if ($status == 0) then
  build/linux-x64/jdk/bin/java -cp ~/work Hello
  if ($status == 0) then
    cp build/linux-x64/jdk/lib/server/libjvm.* $JAVA_HOME/lib/server
  endif
endif

and try to run java -version it crashes like:

# JRE version:  (14.0) (fastdebug build )
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 14-internal+0-2019-07-18-2139061.coleen.null, mixed mode, aot, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x155fdbc]  SharedPathsMiscInfo::check(bool)+0x3c
#

The stack trace is:

Current thread (0x00007fd2b0021800):  JavaThread "Unknown thread" [_thread_in_vm, id=29735, stack(0x00007fd2b7e7d000,0x00007fd2b7f7e000)]

Stack: [0x00007fd2b7e7d000,0x00007fd2b7f7e000], sp=0x00007fd2b7f7c880,  free space=1022k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x155f9dc]  SharedPathsMiscInfo::check(bool)+0x3c
V  [libjvm.so+0x916db1] ClassLoader::check_shared_paths_misc_info(void*, int, bool)+0x71
V  [libjvm.so+0xbc13c3]  FileMapInfo::validate_header(bool)+0x113
V  [libjvm.so+0x12e5672] MetaspaceShared::initialize_runtime_shared_and_meta_spaces()+0x52
V  [libjvm.so+0x12de22d]  Metaspace::global_initialize()+0xed
V  [libjvm.so+0x17174e4]  universe_init()+0xd4
V  [libjvm.so+0xdaf483]  init_globals()+0x63
V  [libjvm.so+0x16d50ca]  Threads::create_vm(JavaVMInitArgs*, bool*)+0x28a
V  [libjvm.so+0xef8c88]  JNI_CreateJavaVM+0x98
C  [libjli.so+0x40ef]  JavaMain+0x7f
C  [libjli.so+0x8159]  ThreadJavaMain+0x9 
Comments
Fix Request [11u]: As mentioned above, this fixes a regression introduced by JDK-8226406. 11.0.7 backported that fix, but not this one, and some builds are now crashing as a result. Patch doesn't apply cleanly, but was reviewed by Jiangli Zhou on the mailing list.
15-04-2020

RFR for 11u: https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2020-April/003020.html
15-04-2020

URL: https://hg.openjdk.java.net/jdk/jdk13/rev/1edf6cc224fb User: ccheung Date: 2019-07-25 17:26:27 +0000
25-07-2019

Fix request approved
25-07-2019

Fix Request A regression in JDK13 caused by the fix for JDK-8226406. By default, the share mode is -Xshare:auto. Even though the checking of the _jvm_ident header fields has failed in FileMapInfo::init_from_file, the UseSharedSpaces flag will be disabled and jvm continues to run and will encounter some other field which hasn't been initialized yet. A simple fix is not to call FileMapInfo::validate_header if the UseSharedSpaces flag has been disabled. The proposed fix only changes one line in hotspot code. Reviewed by: dholmes The risk is low. There's also a jtreg test to test the change. webrev: http://cr.openjdk.java.net/~ccheung/8228407/13-webrev.00/
23-07-2019

ILW = HHL = P2
22-07-2019

By default, the share mode is -Xshare:auto. Even though the checking of the _jvm_ident header fields has failed in FileMapInfo::init_from_file, the UseSharedSpaces flag will be disabled and vm continues to run and will encounter some other field which hasn't been initialized yet. A simple fix is not to call FileMapInfo::validate_header if the UseSharedSpaces flag has been disabled. Proposed fix for JDK14: http://cr.openjdk.java.net/~ccheung/8228407/webrev.00/ The patch should apply cleanly to JDK13.
19-07-2019