RFR: 8373945: vmTestbase eatMemory/ClassUnloader provoke OOME to force GC and might cause GC in other threads [v5]

Chris Plummer cjplummer at openjdk.org
Fri Dec 19 18:46:02 UTC 2025


On Fri, 19 Dec 2025 08:45:37 GMT, SendaoYan <syan at openjdk.org> wrote:

>> Hi all,
>> 
>> This PR use `WhiteBox.getWhiteBox().fullGC()` instead of `eatMemory` to grigger full GC. The OOME trigger by `eatMemory` may cause vmTestbase/nsk/monitoring/stress/classload tests intermittent fails when run those tests simultancely on some machines. The WB.fullGC() might be use for same purpose. It also reduce test execution time.
>> 
>> Change has been verified locally by running tests vmTestbase/nsk/monitoring/stress/classload on linux-x64.
>> 
>> Additional testing:
>> 
>> - [ ] All jtreg tests by fastdebug build
>
> SendaoYan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Increase max iteration for nsk/jvmti/CompiledMethodUnload/compmethunload001/TestDescription.java

There are references to `nsk.share.gc.GCClassUnloader` in some of the test descriptions that need updating.  There are also comments like "Next, debugger forces debuggee to unload class, using memory stressing techique" that need updating. I think you need to review all the test description comments.

I think someone from the GC team should review the GC test changes since WB.fullGC() is a very different approach to ClassUnloader.

test/hotspot/jtreg/vmTestbase/gc/gctests/LargeObjects/large001/large001.java line 154:

> 152: 
> 153:                     // Drop all references to the class and try to unload it
> 154:                     WhiteBox.getWhiteBox().fullGC();

Just to be clear, this is now no different than the `unloader.unloadClass()` call below in terms of how it is implemented. I wonder why the author originally used eatMemory() here and unloadClass() below.

test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype002/TestDescription.java line 71:

> 69:  *      -transport.address=dynamic
> 70:  *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts} -Xbootclasspath/a:.
> 71:  *      -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI" ./bin

In all the JDI tests, this line should be indented to show that it is a continuation of `-debugee.vmkeys `started on the line before.

test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001.java line 50:

> 48:         "nsk.jvmti.CompiledMethodUnload.compmethunload001u";
> 49: 
> 50:     private final static int MAX_ITERATIONS = 50;

Can you explain the need for this change.

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

PR Review: https://git.openjdk.org/jdk/pull/28891#pullrequestreview-3599556766
PR Review Comment: https://git.openjdk.org/jdk/pull/28891#discussion_r2635960204
PR Review Comment: https://git.openjdk.org/jdk/pull/28891#discussion_r2635889453
PR Review Comment: https://git.openjdk.org/jdk/pull/28891#discussion_r2635893925


More information about the serviceability-dev mailing list