RFR: 8369447: GenShen: Regulator thread may observe inconsistent states

Y. Srinivas Ramakrishna ysr at openjdk.org
Fri Oct 17 22:19:00 UTC 2025


On Wed, 8 Oct 2025 18:46:15 GMT, William Kemper <wkemper at openjdk.org> wrote:

> 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.

Nice! 🚢

-------------

Marked as reviewed by ysr (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/27702#pullrequestreview-3352286714


More information about the shenandoah-dev mailing list