JDK-8242267 : Shenandoah: regions space needs to be aligned by os::vm_allocation_granularity()
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 8-shenandoah,11-shenandoah,14,15
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • CPU: x86_64
  • Submitted: 2020-04-07
  • Updated: 2022-02-24
  • Resolved: 2020-04-07
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 14 JDK 15
14.0.2Fixed 15 b18Fixed
Related Reports
Relates :  
Description
Since some days our Windows x64 tests show an assert in ShenandoahHeap::initialize(). 

Note: the last known non-failing VM was tested for: 8241665: Configuring --with-jvm-features=-compiler2 fails to build on AArch64, so the bug must have gotten in afterwards.

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (d:/priv/openjdk/nb/NTAMD64/nightly/jdk/src/hotspot/share/memory/virtualspace.cpp:127), pid=16988, tid=5592
#  assert((size & (granularity - 1)) == 0) failed: size not aligned to os::vm_allocation_granularity()
#
# JRE version:  (15.0.0.1) (fastdebug build )
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 15.0.0.1-internal+0-adhoc.openjdk.jdk, mixed mode, sharing, tiered, compressed oops, shenandoah gc, windows-amd64)
# Core dump will be written. Default location: D:\jvmtests\output_openjdk15_stage_dbgU_ntamd64\jtreg_hotspot_tier1_work\JTwork\gc\shenandoah\oom\TestThreadFailure\hs_err_pid16988.mdmp
#
#

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

Command Line: -Xmx32m -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC TestThreadFailure test

Host: eude02w, Intel(R) Xeon(R) CPU E7-8880 v4 @ 2.20GHz, 8 cores, 23G,  Windows Server 2016 , 64 bit Build 14393 (10.0.14393.2969)
Time: Tue Apr  7 01:36:02 2020 W. Europe Daylight Time elapsed time: 0.026184 seconds (0d 0h 0m 0s)

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

Current thread (0x0000013d799db800):  JavaThread "Unknown thread" [_thread_in_vm, id=5592, stack(0x0000000f65f00000,0x0000000f66000000)]

Stack: [0x0000000f65f00000,0x0000000f66000000]
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [jvm.dll+0x9e0841]  os::platform_print_native_stack+0xf1  (os_windows_x86.cpp:369)
V  [jvm.dll+0xc5e8fb]  VMError::report+0xf0b  (vmerror.cpp:727)
V  [jvm.dll+0xc601ae]  VMError::report_and_die+0x8ae  (vmerror.cpp:1535)
V  [jvm.dll+0xc608a4]  VMError::report_and_die+0x64  (vmerror.cpp:1319)
V  [jvm.dll+0x418512]  report_vm_error+0x102  (debug.cpp:264)
V  [jvm.dll+0xc5a498]  ReservedSpace::initialize+0x58  (virtualspace.cpp:126)
V  [jvm.dll+0xc59aa6]  ReservedSpace::ReservedSpace+0xa6  (virtualspace.cpp:61)
V  [jvm.dll+0xaed95d]  ShenandoahHeap::initialize+0x67d  (shenandoahheap.cpp:287)
V  [jvm.dll+0xc2760c]  universe_init+0xec  (universe.cpp:657)
V  [jvm.dll+0x5beb20]  init_globals+0x80  (init.cpp:116)
V  [jvm.dll+0xbfa698]  Threads::create_vm+0x778  (thread.cpp:3878)
V  [jvm.dll+0x68b9ce]  JNI_CreateJavaVM_inner+0xbe  (jni.cpp:3789)
V  [jvm.dll+0x68e3ff]  JNI_CreateJavaVM+0x1f  (jni.cpp:3872)
C  [jli.dll+0x5343]  JavaMain+0x113  (java.c:417)
C  [ucrtbase.dll+0x1f4a0]
C  [KERNEL32.DLL+0x84d4]
C  [ntdll.dll+0x6e8b1]


---------------  P R O C E S S  ---------------

Threads class SMR info:
_java_thread_list=0x00007ffff5b3a168, length=0, elements={
}
_java_thread_list_alloc_cnt=1, _java_thread_list_free_cnt=0, _java_thread_list_max=0, _nested_thread_list_max=0
_delete_lock_wait_cnt=0, _delete_lock_wait_max=0
_to_delete_list_cnt=0, _to_delete_list_max=0

Java Threads: ( => current thread )

Other Threads:
  0x0000013d79a32000 GCTaskThread "Shenandoah GC Threads#0" [stack: 0x0000000f66000000,0x0000000f66100000] [id=18080]
  0x0000013d79a34800 Thread "Safepoint Cleanup Thread#0" [stack: 0x0000000f66100000,0x0000000f66200000] [id=18116]

=>0x0000013d799db800 (exited) JavaThread "Unknown thread" [_thread_in_vm, id=5592, stack(0x0000000f65f00000,0x0000000f66000000)]

Threads with active compile tasks:

VM state:not at safepoint (not fully initialized)

VM Mutex/Monitor currently owned by a thread: None

Heap address: 0x00000000fe000000, size: 32 MB, Compressed Oops mode: 32-bit
Narrow klass base: 0x0000000000000000, Narrow klass shift: 0

GC Heap History (0 events):
No events

Deoptimization events (0 events):
No events

Classes unloaded (0 events):
No events

Classes redefined (0 events):
No events

Internal exceptions (0 events):
No events

Events (3 events):
Event: 0.010 Loaded shared library D:\jvmtests\output_openjdk15_stage_dbgU_ntamd64\sapjvm_15\bin\java.dll
Event: 0.010 Loaded shared library D:\jvmtests\output_openjdk15_stage_dbgU_ntamd64\sapjvm_15\bin\zip.dll
Event: 0.019 Loaded shared library vmGuestLib


Dynamic libraries:
0x00007ff71f510000 - 0x00007ff71f51d000 	D:\jvmtests\output_openjdk15_stage_dbgU_ntamd64\sapjvm_15\bin\java.exe
0x00007ff812280000 - 0x00007ff812450000 	C:\Windows\SYSTEM32\ntdll.dll
0x00007ff80fab0000 - 0x00007ff80fb5c000 	C:\Windows\System32\KERNEL32.DLL
0x00007ff80eb10000 - 0x00007ff80ed2d000 	C:\Windows\System32\KERNELBASE.dll
0x00007ff80e770000 - 0x00007ff80e864000 	C:\Windows\System32\ucrtbase.dll
0x00007ffff87b0000 - 0x00007ffff87c7000 	D:\jvmtests\output_openjdk15_stage_dbgU_ntamd64\sapjvm_15\bin\jli.dll
0x00007ffff85c0000 - 0x00007ffff85d5000 	D:\jvmtests\output_openjdk15_stage_dbgU_ntamd64\sapjvm_15\bin\VCRUNTIME140.dll
0x00007ff810820000 - 0x00007ff810985000 	C:\Windows\System32\USER32.dll
0x00007ff80eaf0000 - 0x00007ff80eb0e000 	C:\Windows\System32\win32u.dll
0x00007fffff6a0000 - 0x00007fffff91a000 	C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.14393.3053_none_7de042968342015d\COMCTL32.dll
0x00007ff810470000 - 0x00007ff81050e000 	C:\Windows\System32\msvcrt.dll
0x00007ff8109a0000 - 0x00007ff8109d4000 	C:\Windows\System32\GDI32.dll
0x00007ff80ed30000 - 0x00007ff80eeb1000 	C:\Windows\System32\gdi32full.dll
0x00007ff8101a0000 - 0x00007ff810465000 	C:\Windows\System32\combase.dll
0x00007ff810510000 - 0x00007ff810631000 	C:\Windows\System32\RPCRT4.dll
0x00007ff80ef20000 - 0x00007ff80ef8a000 	C:\Windows\System32\bcryptPrimitives.dll
0x00007ffff8230000 - 0x00007ffff82cb000 	D:\jvmtests\output_openjdk15_stage_dbgU_ntamd64\sapjvm_15\bin\msvcp140.dll
0x00007ffff4a30000 - 0x00007ffff5d18000 	D:\jvmtests\output_openjdk15_stage_dbgU_ntamd64\sapjvm_15\bin\server\jvm.dll
0x00007ff810050000 - 0x00007ff8100f2000 	C:\Windows\System32\ADVAPI32.dll
0x00007ff810640000 - 0x00007ff810699000 	C:\Windows\System32\sechost.dll
0x00007ff810990000 - 0x00007ff810998000 	C:\Windows\System32\PSAPI.DLL
0x00007ff803610000 - 0x00007ff803619000 	C:\Windows\SYSTEM32\WSOCK32.dll
0x00007ff80cb00000 - 0x00007ff80cb23000 	C:\Windows\SYSTEM32\WINMM.dll
0x00007ff8048f0000 - 0x00007ff8048fa000 	C:\Windows\SYSTEM32\VERSION.dll
0x00007ff810cb0000 - 0x00007ff810d1a000 	C:\Windows\System32\WS2_32.dll
0x0000013d79120000 - 0x0000013d7914b000 	C:\Windows\SYSTEM32\WINMMBASE.dll
0x00007ff80f710000 - 0x00007ff80f752000 	C:\Windows\System32\cfgmgr32.dll
0x00007ff80e760000 - 0x00007ff80e76f000 	C:\Windows\System32\kernel.appcore.dll
0x00007ffffeee0000 - 0x00007ffffeeec000 	D:\jvmtests\output_openjdk15_stage_dbgU_ntamd64\sapjvm_15\bin\jimage.dll
0x00007ff808a80000 - 0x00007ff808c12000 	C:\Windows\SYSTEM32\DBGHELP.DLL
0x00007ff808a20000 - 0x00007ff808a49000 	C:\Windows\SYSTEM32\dbgcore.DLL
0x00007ff80e350000 - 0x00007ff80e37c000 	C:\Windows\SYSTEM32\SspiCli.dll
0x00007ffff8590000 - 0x00007ffff85b5000 	D:\jvmtests\output_openjdk15_stage_dbgU_ntamd64\sapjvm_15\bin\java.dll
0x00007ffff8210000 - 0x00007ffff8227000 	D:\jvmtests\output_openjdk15_stage_dbgU_ntamd64\sapjvm_15\bin\zip.dll
0x000000006bed0000 - 0x000000006bf31000 	C:\Windows\SYSTEM32\vmGuestLib.DLL
0x000000006cc40000 - 0x000000006cce3000 	C:\Windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.9247_none_08e394a1a83e212f\MSVCR90.dll
0x00007ff801ff0000 - 0x00007ff802005000 	C:\Windows\system32\vsocklib.dll

dbghelp: loaded successfully - version: 4.0.5 - missing functions: none
symbol engine: initialized successfully - sym options: 0x614 - pdb path: .;D:\jvmtests\output_openjdk15_stage_dbgU_ntamd64\sapjvm_15\bin;C:\Windows\SYSTEM32;C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.14393.3053_none_7de042968342015d;D:\jvmtests\output_openjdk15_stage_dbgU_ntamd64\sapjvm_15\bin\server;C:\Windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.9247_none_08e394a1a83e212f

VM Arguments:
jvm_args: -Xmx32m -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC 
java_command: TestThreadFailure test
java_class_path (initial): D:\jvmtests\output_openjdk15_stage_dbgU_ntamd64\jtreg_hotspot_tier1_work\JTwork\classes\gc\shenandoah\oom\TestThreadFailure.d;D:\jvmtests\output_openjdk15_stage_dbgU_ntamd64\grmpf\testdata\jtreg\jtreg_test_15\test\hotspot\jtreg\gc\shenandoah\oom;D:\jvmtests\output_openjdk15_stage_dbgU_ntamd64\jtreg_hotspot_tier1_work\JTwork\classes\test\lib;D:\jvmtests\output_openjdk15_stage_dbgU_ntamd64\grmpf\testdata\jtreg\jtreg_test_15\test\lib;D:\jvmtests\jtreg_sapjvm_o_jdk\lib\javatest.jar;D:\jvmtests\jtreg_sapjvm_o_jdk\lib\jtreg.jar
Launcher Type: SUN_STANDARD

[Global flags]
     intx CICompilerCount                          = 4                                         {product} {ergonomic}     Number of compiler threads to run
   size_t InitialHeapSize                          = 33554432                                  {product} {ergonomic}     Initial heap size (in bytes); zero means use ergonomics
   size_t MaxHeapSize                              = 33554432                                  {product} {command line}  Maximum heap size (in bytes)
   size_t MinHeapDeltaBytes                        = 262144                                    {product} {ergonomic}     The minimum change in heap space due to GC (in bytes)
   size_t MinHeapSize                              = 6815744                                   {product} {ergonomic}     Minimum heap size (in bytes); zero means use ergonomics
    uintx NonNMethodCodeHeapSize                   = 5839372                                {pd product} {ergonomic}     Size of code heap with non-nmethods (in bytes)
    uintx NonProfiledCodeHeapSize                  = 122909434                              {pd product} {ergonomic}     Size of code heap with non-profiled methods (in bytes)
    uintx ProfiledCodeHeapSize                     = 122909434                              {pd product} {ergonomic}     Size of code heap with profiled methods (in bytes)
    uintx ReservedCodeCacheSize                    = 251658240                              {pd product} {ergonomic}     Reserved code cache size (in bytes) - maximum code cache size
     bool SegmentedCodeCache                       = true                                      {product} {ergonomic}     Use a segmented code cache
   size_t SoftMaxHeapSize                          = 33554432                               {manageable} {ergonomic}     Soft limit for maximum heap size (in bytes)
     bool UnlockExperimentalVMOptions              = true                                 {experimental} {command line}  Enable normal processing of flags relating to experimental features
     bool UseCompressedClassPointers               = true                                 {lp64_product} {ergonomic}     Use 32-bit class pointers in 64-bit VM. lp64_product means flag is always constant in 32 bit VM
     bool UseCompressedOops                        = true                                 {lp64_product} {ergonomic}     Use 32-bit object references in 64-bit VM. lp64_product means flag is always constant in 32 bit VM
     bool UseLargePagesIndividualAllocation        = false                                  {pd product} {ergonomic}     Allocate large pages individually for better affinity
     bool UseShenandoahGC                          = true                                 {experimental} {command line}  Use the Shenandoah garbage collector

Logging:
Log output configuration:
 #0: stdout all=warning uptime,level,tags
 #1: stderr all=off uptime,level,tags

Environment Variables:
CLASSPATH=D:\jvmtests\output_openjdk15_stage_dbgU_ntamd64\jtreg_hotspot_tier1_work\JTwork\classes\gc\shenandoah\oom\TestThreadFailure.d;D:\jvmtests\output_openjdk15_stage_dbgU_ntamd64\grmpf\testdata\jtreg\jtreg_test_15\test\hotspot\jtreg\gc\shenandoah\oom;D:\jvmtests\output_openjdk15_stage_dbgU_ntamd64\jtreg_hotspot_tier1_work\JTwork\classes\test\lib;D:\jvmtests\output_openjdk15_stage_dbgU_ntamd64\grmpf\testdata\jtreg\jtreg_test_15\test\lib;D:\jvmtests\jtreg_sapjvm_o_jdk\lib\javatest.jar;D:\jvmtests\jtreg_sapjvm_o_jdk\lib\jtreg.jar
PATH=D:\jvmtests\cygwin\bin;D:\jvmtests\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\opscode\chef\bin\;C:\Users\jvmtests\AppData\Local\Microsoft\WindowsApps



---------------  S Y S T E M  ---------------

HostName: eude02w OS: Windows Server 2016 , 64 bit Build 14393 (10.0.14393.2969)
OS uptime: 137 days 13:06 hours
VMWare virtualization detected
vSphere host information:
host.cpu.processorMHz = 2194
host.cpu.coresPerPkg = 22

vSphere resource information collected at VM startup:
vm.cpu.reserved = 0
vm.cpu.limit = -1
vm.cpu.used = 5381750062870
vm.cpu.contention.cpu = 5871780871
vm.cpu.contention.mem = 0
vm.numa.local = 25146828
vm.numa.remote = 2612
guest.mem.reserved = 0
guest.mem.limit = -1
guest.mem.mapped = 25149440
guest.mem.consumed = 25145868
guest.mem.swapped = 0
guest.mem.ballooned = 0
guest.mem.swapIn = 0
guest.mem.swapOut = 0
ovhd.mem.swapped = 0
ovhd.mem.swapIn = 0
ovhd.mem.swapOut = 0

vSphere resource information available now:
vm.cpu.reserved = 0
vm.cpu.limit = -1
vm.cpu.used = 5381751612408
vm.cpu.contention.cpu = 5871781878
vm.cpu.contention.mem = 0
vm.numa.local = 25146828
vm.numa.remote = 2612
guest.mem.reserved = 0
guest.mem.limit = -1
guest.mem.mapped = 25149440
guest.mem.consumed = 25145868
guest.mem.swapped = 0
guest.mem.ballooned = 0
guest.mem.swapIn = 0
guest.mem.swapOut = 0
ovhd.mem.swapped = 0
ovhd.mem.swapIn = 0
ovhd.mem.swapOut = 0


CPU:total 8 (initial active 8) (1 cores per cpu, 1 threads per core) family 6 model 79 stepping 1, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, vzeroupper, avx, avx2, aes, clmul, erms, rtm, 3dnowpref, lzcnt, tsc, tscinvbit, bmi1, bmi2, adx, fma, clflush

Memory: 4k page, system-wide physical 24559M (17080M free)
TotalPageFile size 44559M (AvailPageFile size 33935M)
current process WorkingSet (physical memory assigned to process): 55M, peak: 55M
current process commit charge ("private bytes"): 81M, peak: 81M

vm_info: OpenJDK 64-Bit Server VM (fastdebug 15.0.0.1-internal+0-adhoc.openjdk.jdk) for windows-amd64 JRE (15.0.0.1-internal+0-adhoc.openjdk.jdk), built on Apr  6 2020 20:09:30 by "openjdk" with MS VC++ 15.9 (VS2017)

END.

Comments
Fix Request (14u) This is a follow-up for JDK-8241845 backport. Patch applies cleanly to 14u, passes hotspot_gc_shenandoah, tier{1,2,3} with Shenandoah enabled. The patch is fully contained in Shenandoah code.
30-04-2020

RFR: https://mail.openjdk.java.net/pipermail/shenandoah-dev/2020-April/011891.html
07-04-2020

Ah, I see. Other ReservedSpaces (heap, bitmap) implicitly align by os::vm_allocation_granularity() when computing their sizes. We should do the same here: diff -r 3f8d03880bf5 src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Tue Apr 07 03:25:11 2020 +0000 +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Tue Apr 07 11:31:03 2020 +0200 @@ -281,10 +281,11 @@ // // Create regions and region sets // size_t region_align = align_up(sizeof(ShenandoahHeapRegion), SHENANDOAH_CACHE_LINE_SIZE); size_t region_storage_size = align_up(region_align * _num_regions, region_page_size); + region_storage_size = align_up(region_storage_size, os::vm_allocation_granularity()); ReservedSpace region_storage(region_storage_size, region_page_size); MemTracker::record_virtual_memory_type(region_storage.base(), mtGC); if (!region_storage.special()) { os::commit_memory_or_exit(region_storage.base(), region_storage_size, region_page_size, false,
07-04-2020

I think it was caused by JDK-8241845 that introduced new ReservedSpace (at least the line number in the log above points to that). The size of that region space must be aligned to page size, and it does! size_t region_storage_size = align_up(region_align * _num_regions, region_page_size); ReservedSpace region_storage(region_storage_size, region_page_size);
07-04-2020

URL: https://hg.openjdk.java.net/jdk/jdk/rev/546e0abd767e User: shade Date: 2020-04-07 12:33:23 +0000
07-04-2020