RFR: 8057586: Explicit GC ignored if GCLocker is active [v2]

Albert Mingkun Yang ayang at openjdk.org
Tue Mar 28 15:57:02 UTC 2023


On Tue, 28 Mar 2023 13:03:36 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:

>> Hi All,
>> 
>> Please review this change to guarantee that at least a Full GC is executed between the invocation and return of `System.gc` or `WhiteBox.fullGC`, even if the call is concurrent with an active `GCLocker `. 
>> 
>> The change should also handle the issues reported in JDK-8299276.
>> 
>> Split into 3 commits, one commit for changes to each GC in [G1, Parallel, Serial]. 
>> 
>> Testing: Tier 1-5.
>
> Ivan Walulya has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Albert review

test/hotspot/jtreg/gc/TestJNICriticalStressTest.java line 160:

> 158: 
> 159:                 long gcCountAfter = collector.getCollectionCount();
> 160:                 Asserts.assertLessThanOrEqual(gcCountBefore + fullGcCounts, gcCountAfter, "Triggered more Full GCs than expected");

Does this work?

var before = collector.getCollectionCount();
wb.fullGC();
var after = collector.getCollectionCount();
assert(before < after);

test/hotspot/jtreg/gc/TestJNICriticalStressTest.java line 236:

> 234:             now = System.currentTimeMillis();
> 235:             soFar = now - start;
> 236:         }

I believe it's unexpected for the current thread to be interrupted; if so, it should log the exception and exit peacefully, as there's no enough info here to properly process it.


try {
    Thread.sleep(durationSec * 1000);
} catch (InterruptedException e) {
    e.printStackTrace();
    return;
}

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13191#discussion_r1150836213
PR Review Comment: https://git.openjdk.org/jdk/pull/13191#discussion_r1150829875


More information about the hotspot-gc-dev mailing list