RFR: 8357550: GenShen crashes during freeze: assert(!chunk->requires_barriers()) failed
William Kemper
wkemper at openjdk.org
Thu Jun 19 20:27:23 UTC 2025
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).
-------------
Commit messages:
- override requires_barriers for generational mode
Changes: https://git.openjdk.org/jdk/pull/25905/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25905&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8357550
Stats: 25 lines in 2 files changed: 25 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/25905.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/25905/head:pull/25905
PR: https://git.openjdk.org/jdk/pull/25905
More information about the shenandoah-dev
mailing list