RFR: 8305903: Deflate monitors of dead objects before they become unreachable
Roman Kennke
rkennke at openjdk.org
Fri Apr 28 19:27:53 UTC 2023
With compact object headers ([JDK-8305895](https://bugs.openjdk.org/browse/JDK-8305895)), I've seen occasional failures in G1, where the refinement thread tries to parse a heap region that has dead objects, and would sometimes see an object with a monitor that has already been deflated. And because deflation does not bother to restore the header of dead objects, when heap iteration tries to load the Klass* of the dead object, it would reach to unknown memory and crash.
The fix is to restore the header of dead objects just before they become unreachable. This can be done in the closures used by WeakProcessor::weak_oops_do(), right before the weak root will be cleared.
Notice that this is only a bug with compact object headers. It doesn't hurt to fix this in general, though.
Testing:
- [x] tier1
- [x] tier2
-------------
Commit messages:
- 8305903: Deflate monitors of dead objects before they become unreachable
Changes: https://git.openjdk.org/jdk/pull/13721/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13721&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8305903
Stats: 24 lines in 4 files changed: 23 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/13721.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13721/head:pull/13721
PR: https://git.openjdk.org/jdk/pull/13721
More information about the hotspot-dev
mailing list