RFR: 8275329: ZGC: vmTestbase/gc/gctests/SoftReference/soft004/soft004.java fails with assert(_phases->length() <= 1000) failed: Too many recored phases?
Per Liden
pliden at openjdk.java.net
Thu Nov 11 16:06:49 UTC 2021
In ZGC, the phases the "Pause Mark End" and "Concurrent Mark Continue" can be executed multiple times in the same GC cycle. This can happen for two reasons:
1) After "Concurrent Mark Continue" has terminated, but before "Pause Mark End" has started, a `SoftReference` or a `WeakReference` is resurrected by a call to `Reference.get()` from a Java thread.
2) A Java thread "hides" work from the GC worker threads doing marking, by detaching unmarked objects from the graph and push it to a thread local mark stack, that the GC needs to flush out. An example of this is when a Java thread continuously removes the first element in a single linked list that hasn't been marked yet.
The above events are typically rare, but it is possible to write a program that causes the above GC phases to be executed a large number of times. The test that failed (`soft004.java`) runs into case 2 above, where it has ~50,000,000 SoftReferences in the reference processing pending list (a single linked list) and continuously removes the first element until the list if empty. This causes more than 1000 "Pause Mark End" attempt to happen. For that reason, we don't want `TimePartitions` to assert if there are more than 1000 phases. This patch disables the assert in question if ZGC is used. An alternative would be to remove the assert completely, but @stefank preferred to just disable it for ZGC.
-------------
Commit messages:
- 8275329: ZGC: vmTestbase/gc/gctests/SoftReference/soft004/soft004.java fails with assert(_phases->length() <= 1000) failed: Too many recored phases?
Changes: https://git.openjdk.java.net/jdk/pull/6358/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6358&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8275329
Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod
Patch: https://git.openjdk.java.net/jdk/pull/6358.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/6358/head:pull/6358
PR: https://git.openjdk.java.net/jdk/pull/6358
More information about the hotspot-gc-dev
mailing list