RFR: 8357550: GenShen crashes during freeze: assert(!chunk->requires_barriers()) failed

Aleksey Shipilev shade at openjdk.org
Fri Jun 20 08:50:29 UTC 2025


On Thu, 19 Jun 2025 20:21:35 GMT, William Kemper <wkemper at openjdk.org> wrote:

> Shenandoah captures a preliminary top-at-mark-start (TAMS) concurrently. Once concurrent marking has begun, any object beneath TAMS requires a barrier when accessed. The implementation of `ShenandoahHeap::requires_barrier` does not distinguish between _old_ and _young_ marking. This could lead to a race between freezing the stack and capturing TAMS:
> 
> 1. Collector is marking old
> 2. Allocate stack chunk in young
> 3. Barrier is not needed, begin fast freeze path
> 4. Collector concurrently updates TAMS (young marking will start once init-mark safepoint is reached)
> 5. ShenandoahHeap now thinks the barrier is needed (because TAMS changed, and we are marking old)
> 6. Fast freeze asserts out
> 
> This fix has the generational mode check the appropriate generation and its marking state. It also enforces barriers for stackChunks in the old generation (for card marking).

This makes sense.

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

Marked as reviewed by shade (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/25905#pullrequestreview-2945074807


More information about the hotspot-gc-dev mailing list