JDK-8038268 : VM Crashes in MetaspaceShared::generate_vtable_methods while creating CDS archive with limiting SharedMiscCodeSize
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2014-03-24
  • Updated: 2015-06-03
  • Resolved: 2014-10-23
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 8 JDK 9
8u40Fixed 9 b40Fixed
Related Reports
Relates :  
Description
Found during CDS testing. 
Use the following command: 
/home/mseledtsov/data2/jdk/9/jdk9_b01_fd/fastdebug/bin/java -XX:+UnlockDiagnosticVMOptions -XX:SharedArchiveFile=./test.jsa -XX:SharedMiscCodeSize=20k -Xshare:dump


Comments
No regression test is needed, since the reg test already exists that caught this problem in the first place.
22-10-2014

A fix is to estimate the minimum required size for the misc code region based on the instructions in the MetaspaceShared::generate_vtable_methods() method. The formula is as follows: min_misc_code_size = (num_virtuals * vtbl_list_size) * (sizeof(void*) + vtbl_method_size) + vtbl_common_code_size num_virtuals and vtbl_list_size already exists in metaspaceShared.hpp. vtbl_method_size and vtbl_common_code_size will be added. If the user's specified misc code size is less than the minimum required size, the vm will issue an error message instead of crashing.
21-10-2014

Once fixed, please enable the corresponding commented out clause in the test <jdk9>/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.java
26-03-2014

The logs and test are attached
24-03-2014

# # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007f2e6344c727, pid=4855, tid=139837175846656 # # JRE version: (9.0-b01) (build ) # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.0-b62-fastdebug interpreted mode linux-amd64 compressed oops) # Problematic frame: # V [libjvm.so+0x3e5727] Assembler::movl(RegisterImpl*, int)+0x37 # # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # # If you would like to submit a bug report, please visit: # http://bugreport.sun.com/bugreport/crash.jsp # --------------- T H R E A D --------------- Current thread (0x00007f2e5c18e800): VMThread [stack: 0x00007f2e61215000,0x00007f2e61316000] [id=4857] siginfo:si_signo=SIGSEGV: si_errno=0, si_code=1 (SEGV_MAPERR), si_addr=0x0000000802405000 Registers: RAX=0x00000000ffffffb8, RBX=0x0000000000000000, RCX=0x00007f2e61314220, RDX=0x0000000802405000 RSP=0x00007f2e61314120, RBP=0x00007f2e61314140, RSI=0x0000000000000000, RDI=0x00007f2e61314220 R8 =0x0000000000000000, R9 =0x00000000000012f9, R10=0x0000000000000400, R11=0x0000000000000010 R12=0x00007f2e5c08ad58, R13=0x0000000000000a30, R14=0x0000000000000a00, R15=0x00007f2e613144c0 RIP=0x00007f2e6344c727, EFLAGS=0x0000000000010286, CSGSFS=0x0000000000000033, ERR=0x0000000000000006 TRAPNO=0x000000000000000e Top of Stack: (sp=0x00007f2e61314120) 0x00007f2e61314120: 0000000000000030 0000000000000031 0x00007f2e61314130: 0000000802004098 00007f2e5c08ad58 0x00007f2e61314140: 00007f2e61314510 00007f2e63cb67df 0x00007f2e61314150: 0000000000000000 0000000000000000 0x00007f2e61314160: 0000000000000000 0000000000000000 0x00007f2e61314170: 0000000000000000 0000000000000000 0x00007f2e61314180: 0000000000000000 0000000000000000 0x00007f2e61314190: 00007f2e613141c0 00007f2e61314730 0x00007f2e613141a0: 0000000802000000 0000000000000000 0x00007f2e613141b0: 0000000a00000000 0000000802003f10 0x00007f2e613141c0: 00007f2e645bfc50 00007f2e6407d772 0x00007f2e613141d0: 0000000000000000 0000000000000000 0x00007f2e613141e0: 0000000000000000 0000000000000000 0x00007f2e613141f0: 0000000000000000 0000000000000000 0x00007f2e61314200: 0000000000000000 0000000000000000 0x00007f2e61314210: 00007f2e61000000 00007f2e613141c0 0x00007f2e61314220: 0000000802400000 0000000000000000 0x00007f2e61314230: 0000000802405000 0000000802405000 0x00007f2e61314240: 0000000000000000 0000000000000000 0x00007f2e61314250: 0000000000000000 0000000802400000 0x00007f2e61314260: 0000000000010000 00007f2e613141c0 0x00007f2e61314270: 0000000000000000 0000000000000000 0x00007f2e61314280: 0000000000000000 0000000000000000 0x00007f2e61314290: 0000000000000000 0000000000000000 0x00007f2e613142a0: 0000000000000000 0000000000000000 0x00007f2e613142b0: 00007f2e64020000 00007f2e613141c0 0x00007f2e613142c0: 0000000000000000 0000000000000000 0x00007f2e613142d0: 0000000802400000 0000000000005000 0x00007f2e613142e0: 00007f2e613142f0 0000000000000000 0x00007f2e613142f0: 00007f2e6459b6f0 ffff80d19ecebd0f 0x00007f2e61314300: 0000000000000000 00007f2e645d8e10 0x00007f2e61314310: 0000000000000000 0000000000000000 Instructions: (pc=0x00007f2e6344c727) 0x00007f2e6344c707: 83 ec 20 41 89 d5 e8 3e b1 00 00 83 f8 07 89 c3 0x00007f2e6344c717: 7f 47 49 8b 7c 24 18 89 d8 83 c8 b8 48 8b 57 10 0x00007f2e6344c727: 88 02 48 8b 77 10 48 83 c6 01 e8 9a f0 ef ff 49 0x00007f2e6344c737: 8b 7c 24 18 48 8b 47 10 44 89 28 48 8b 77 10 48 Register to memory mapping: RAX=0x00000000ffffffb8 is an unallocated location in the heap RBX=0x0000000000000000 is an unknown value RCX=0x00007f2e61314220 is an unknown value RDX=0x0000000802405000 is an unknown value RSP=0x00007f2e61314120 is an unknown value RBP=0x00007f2e61314140 is an unknown value RSI=0x0000000000000000 is an unknown value RDI=0x00007f2e61314220 is an unknown value R8 =0x0000000000000000 is an unknown value R9 =0x00000000000012f9 is an unknown value R10=0x0000000000000400 is an unknown value R11=0x0000000000000010 is an unknown value R12=0x00007f2e5c08ad58 is an unknown value R13=0x0000000000000a30 is an unknown value R14=0x0000000000000a00 is an unknown value R15=0x00007f2e613144c0 is an unknown value Stack: [0x00007f2e61215000,0x00007f2e61316000], sp=0x00007f2e61314120, free space=1020k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0x3e5727] Assembler::movl(RegisterImpl*, int)+0x37 V [libjvm.so+0xc4f7df] MetaspaceShared::generate_vtable_methods(void**, void**, char**, char*, char**, char*)+0x44f V [libjvm.so+0xc4de86] VM_PopulateDumpSharedSpace::doit()+0x276 V [libjvm.so+0xf8afc5] VM_Operation::evaluate()+0xa5 V [libjvm.so+0xf889e7] VMThread::evaluate_operation(VM_Operation*)+0x137 V [libjvm.so+0xf894e0] VMThread::loop()+0x660 V [libjvm.so+0xf89710] VMThread::run()+0xb0 V [libjvm.so+0xcf80a8] java_start(Thread*)+0x108 VM_Operation (0x00007f2e652ab600): PopulateDumpSharedSpace, mode: safepoint, requested by thread 0x00007f2e5c00c000
24-03-2014