JDK-8334010 : VM crashes with ObjectAlignmentInBytes > GCCardSizeInBytes
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 18,19,20,21,22,23,24
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-06-11
  • Updated: 2024-10-21
  • Resolved: 2024-10-16
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 24
24 b20Fixed
Related Reports
Relates :  
Description
When card table card size < ObjectAlignmentInBytes the gc.g1.TestShrinkAuxiliaryData test crashes with:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (.../src/hotspot/share/gc/g1/g1HeapRegion.inline.hpp:359), pid=56642, tid=56666
#  assert(bitmap->is_marked(cur)) failed: cur 0x00007f0c5ea7fe00 start 0x00007f0c5ea7fd80 end 0x00007f0c5ea7fe80 block-start 0x00007f0c5ea7f900
#

# JRE version: Java(TM) SE Runtime Environment (23.0) (fastdebug build 23-internal-2024-06-11-1002105.roberto.castaneda.lozano.g1-late-barrier-expansion)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 23-internal-2024-06-11-1002105.roberto.castaneda.lozano.g1-late-barrier-expansion, mixed mode, tiered, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xd2a66a]  HeapWordImpl** G1HeapRegion::oops_on_memregion_iterate<G1ScanCardClosure, true>(MemRegion, G1ScanCardClosure*)+0x83a
#
# Core dump will be written. Default location: Core dumps may be processed with "/opt/core.sh %p" (or dumping to /opt/mach5/mesos/work_dir/slaves/a4a7850a-7c35-410a-b879-d77fbb2f6087-S15024/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/2a5d4929-9976-4f60-ad08-d7b3764f734e/runs/28c650f1-1cdb-4ad6-be25-6dbf2aec15f0/testoutput/test-support/jtreg_open_test_hotspot_jtreg_gc_g1_TestShrinkAuxiliaryDataRunner_java/scratch/0/core.56642)
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

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

Command Line: -XX:MaxRAMPercentage=4.16667 [...] -XX:-UseCompressedOops -XX:+G1StressBarriers -Xshare:off -XX:NewSize=16m -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=11 -XX:+UseG1GC -XX:G1HeapRegionSize=1048576 -XX:-ExplicitGCInvokesConcurrent -Xlog:gc=debug -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED -Xbootclasspath/a:. -XX:ObjectAlignmentInBytes=256 gc.g1.TestShrinkAuxiliaryData$ShrinkAuxiliaryDataTest

Host: ol8-x64-311520, AMD EPYC 7J13 64-Core Processor, 12 cores, 23G, Oracle Linux Server release 8.9

Time: Tue Jun 11 10:45:15 2024 UTC elapsed time: 0.278185 seconds (0d 0h 0m 0s)

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

Current thread (0x00007f0c3c00c850):  WorkerThread "GC Thread#5"    [id=56666, stack(0x00007f0c1bafc000,0x00007f0c1bbfc000) (1024K)]

Stack: [0x00007f0c1bafc000,0x00007f0c1bbfc000],  sp=0x00007f0c1bbfa990,  free space=1018k

Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)

V  [libjvm.so+0xd2a66a]  HeapWordImpl** G1HeapRegion::oops_on_memregion_iterate<G1ScanCardClosure, true>(MemRegion, G1ScanCardClosure*)+0x83a  (g1HeapRegion.inline.hpp:359)
V  [libjvm.so+0xd2ad36]  void G1ScanHRForRegionClosure::ChunkScanner::on_dirty_cards<G1ScanHRForRegionClosure::scan_heap_roots(G1HeapRegion*)::{lambda(unsigned char*, unsigned char*)#1}>(G1ScanHRForRegionClosure::scan_heap_roots(G1HeapRegion*)::{lambda(unsigned char*, unsigned char*)#1}&&)+0x2e6  (g1HeapRegion.inline.hpp:472)
V  [libjvm.so+0xd2334b]  G1RemSet::scan_heap_roots(G1ParScanThreadState*, unsigned int, G1GCPhaseTimes::GCParPhases, G1GCPhaseTimes::GCParPhases, bool)+0x5fb  (g1RemSet.cpp:664)
V  [libjvm.so+0xd5473b]  G1EvacuateRegionsTask::scan_roots(G1ParScanThreadState*, unsigned int)+0x4b  (g1YoungCollector.cpp:665)
V  [libjvm.so+0xd54c57]  G1EvacuateRegionsBaseTask::work(unsigned int)+0x87  (g1YoungCollector.cpp:651)
V  [libjvm.so+0x1912df0]  WorkerThread::run()+0x80  (workerThread.cpp:70)
V  [libjvm.so+0x17d0056]  Thread::call_run()+0xb6  (thread.cpp:225)
V  [libjvm.so+0x14b7ab7]  thread_native_entry(Thread*)+0x127  (os_linux.cpp:846)

This is with the current changes for JEP 475, but it should also be reproducible otherwise due to

-XX:GCCardSizeInBytes=128 (from -XX:G1StressBarriers) and -XX:ObjectAlignmentInBytes=256 (it reproduces with both -XX:+/-UseCompressedOops)

In that build that assert has also been modified to print cur/start/end/block_start.

There might be issues with the BOT (not all elements containing valid values) and that the mark bitmap is coarsened to 256 byte object alignment and the back-and-forth calculation.

One option to fix this is to disallow this combination of flags (card size < OAIB) if this proves to be the issue.
Comments
Changeset: 577babf1 Branch: master Author: Thomas Schatzl <tschatzl@openjdk.org> Date: 2024-10-16 07:27:28 +0000 URL: https://git.openjdk.org/jdk/commit/577babf1968700e4b648305cd5a5c2ddf712e2dc
16-10-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/21515 Date: 2024-10-15 08:10:09 +0000
15-10-2024

The following workaround suggested by [~ayang] seems to solve the problem: https://github.com/robcasloz/jdk/commit/9543ffc969de2943ff4db86327b7344e4df63f36 With the workaround enabled (-XX:+UseNewCode), no failure is seen in 10000 test runs. With the workaround disabled (-XX:-UseNewCode), the failure triggers within 2000 runs.
12-06-2024

Late barrier expansion repo: https://github.com/robcasloz/jdk/tree/g1-late-barrier-expansion
11-06-2024