RFR: 8369447: GenShen: Regulator thread may observe inconsistent states
William Kemper
wkemper at openjdk.org
Wed Oct 8 18:53:22 UTC 2025
Shenandoah's generational mode runs a separate thread to monitor the heap during old collections. This thread is responsible for deciding to start collections. When the thread which actually runs collections (the control thread) changes the state of various gc components _on a safepoint_, it has the expectation that these changes will become visible to mutator threads atomically, and consistently. However, the regulator thread does not participate in safepoints and may observe gc components in inconsistent states and so make incorrect choices about trying to start GC cycles.
For example:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (src/hotspot/share/gc/shenandoah/heuristics/shenandoahOldHeuristics.cpp:625), pid=3796044, tid=3796163
# assert(_old_generation->state() == ShenandoahOldGeneration::MARKING) failed: Unexpected old gen state: Waiting for Bootstrap
#
The solution here is to make the regulator thread participate in safepoints. There is no need for it to run during a safepoint.
-------------
Commit messages:
- Merge remote-tracking branch 'jdk/master' into suspend-regulator-thread
- Suspend regulator thread during safepoints
Changes: https://git.openjdk.org/jdk/pull/27702/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27702&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8369447
Stats: 3 lines in 1 file changed: 3 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/27702.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/27702/head:pull/27702
PR: https://git.openjdk.org/jdk/pull/27702
More information about the shenandoah-dev
mailing list