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
Fri Nov 12 08:21:38 UTC 2021


On Thu, 11 Nov 2021 15:40:05 GMT, Per Liden <pliden at openjdk.org> wrote:

> 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.

Thanks for reviewing!

-------------

PR: https://git.openjdk.java.net/jdk/pull/6358



More information about the hotspot-gc-dev mailing list