RFR: 8261448: Preserve GC stack watermark across safepoints in StackWalk [v2]
Roman Kennke
rkennke at openjdk.java.net
Fri Feb 12 21:45:57 UTC 2021
> I am observing the following assert:
>
> # Internal Error (/home/rkennke/src/openjdk/loom/src/hotspot/share/runtime/stackWatermark.cpp:178), pid=54418, tid=54534
> # assert(is_frame_safe(f)) failed: Frame must be safe
>
> (see issue for full hs_err)
>
> In StackWalk::fetchNextBatch() we prepare the entire stack to be processed by calling StackWatermarkSet::finish_processing(jt, NULL, StackWatermarkKind::gc), but then subsequently, during frames scan, perform allocations to fill in the frame information (fill_in_frames => LiveFrameStream::fill_frame => fill_live_stackframe) at where we could safepoint for GC, which could reset the stack watermark.
>
> This is only relevant for GCs that use the StackWatermark, e.g. ZGC and Shenandoah at the moment.
>
> Solution is to preserve the stack-watermark across safepoints in StackWalk::fetchNextBatch(). StackWalk::fetchFirstBatch() doesn't look to be affected by this: it is not using the stack-watermark.
>
> Testing:
> - [x] StackWalk tests with Shenandoah/aggressive
> - [x] StackWalk tests with ZGC/aggressive
> - [ ] tier1 (+Shenandoah/ZGC)
> - [ ] tier2 (+Shenandoah/ZGC)
Roman Kennke has updated the pull request incrementally with one additional commit since the last revision:
Make KeepStackGCProcessedMark reentrant; Place a KeepStackGCProcessedMark in StackWalker::fetchFirstBatch()
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/2500/files
- new: https://git.openjdk.java.net/jdk/pull/2500/files/72f20e13..6946499c
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2500&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2500&range=00-01
Stats: 12 lines in 4 files changed: 10 ins; 0 del; 2 mod
Patch: https://git.openjdk.java.net/jdk/pull/2500.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/2500/head:pull/2500
PR: https://git.openjdk.java.net/jdk/pull/2500
More information about the hotspot-gc-dev
mailing list