RFR: 8262197: JDK-8242032 uses wrong contains_reference() in assertion code
Thomas Schatzl
tschatzl at openjdk.java.net
Tue Feb 23 14:16:00 UTC 2021
Hi all,
can I have reviews for this change that fixes use of the wrong HeapRegionRemSet::contains_reference() method, causing a thread lock the same mutex again, resulting in problems like assertion failures?
The code in question has been introduced in JDK-8242032:
+ // Rechecking if the region is coarsened, while holding the lock.
+ if (is_region_coarsened(from_hrm_ind)) {
+ assert(contains_reference(from), "We just found " PTR_FORMAT " in the Coarse table", p2i(from));
+ return;
+ }
The problem is the call to `contains_reference`, which locks the same lock that "we know we are already locking" per the comment above. Correct is using `contains_reference_locked` added for just this purpose.
In the original change the PR already mentioned that the situation where this condition should hold could not be reproduced - now we know that it actually occurs ;)
Testing: tier1. Trying to reproduce with the original some of the failing tests without luck - however the problematic line and the fix is very obvious.
Thanks,
Thomas
-------------
Commit messages:
- Use correct contains_reference_locked
Changes: https://git.openjdk.java.net/jdk/pull/2690/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2690&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8262197
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.java.net/jdk/pull/2690.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/2690/head:pull/2690
PR: https://git.openjdk.java.net/jdk/pull/2690
More information about the hotspot-gc-dev
mailing list