RFR: 8375485: Tests in vmTestbase/nsk are failing due to missing class unloading after 8373945
Leonid Mesnik
lmesnik at openjdk.org
Sun Jan 18 20:17:30 UTC 2026
On Sat, 17 Jan 2026 04:05:14 GMT, SendaoYan <syan at openjdk.org> wrote:
> Hi all,
>
> This PR make 2 changes which make test more rubustness:
>
> 1. Add max 10 times tries which removed by JDK-8342659, this will make test more steady after JDK-8373945. vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001/TestDescription.java fails before this PR, run passed after this PR with fastdebug build.
> 2. test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003.java try to invoke thread and do not wailt the thread run finish unload the class immediately. This PR wait util the thread is non alive, and wait more 2 senonds to make sure the thread exit completely. This will make test more robustness, before this PR vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003/TestDescription.java fails probability 1/50, after this PR test run all passed 10k times.
>
> Additional testing:
>
> - [ ] All tests touched test by JDK-8373945
Changes requested by lmesnik (Reviewer).
test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003.java line 109:
> 107:
> 108: while (thrd.isAlive()) {
> 109: logger.display("Thread state: " + thrd.getState()
Please add some sleep to don't produce huge amount of output.
test/hotspot/jtreg/vmTestbase/nsk/share/ClassUnloader.java line 254:
> 252: WhiteBox.getWhiteBox().fullGC();
> 253: int count = 0;
> 254: while (count++ < MAX_UNLOAD_ATTEMPS && !isClassLoaderReclaimed()) {
Thanks for the fix. I find the same. The old unloading method triggered several GCs and took a lot of time.
So might be this allowed all classes/method to freed and corresponding events to be generate.
The method unloading event might be generated after full GC is completed. It is called on ServiceThread with some latency. And haven't time to check another events.
test/hotspot/jtreg/vmTestbase/nsk/share/ClassUnloader.java line 256:
> 254: while (count++ < MAX_UNLOAD_ATTEMPS && !isClassLoaderReclaimed()) {
> 255: System.out.println("ClassUnloader: waiting for class loader reclaiming... " + count);
> 256: WhiteBox.getWhiteBox().fullGC();
Can you add some small delay (100ms) between attempts. To give more chances to process ojbects inside VM like jvmti deferred queue.
-------------
PR Review: https://git.openjdk.org/jdk/pull/29285#pullrequestreview-3675260387
PR Review Comment: https://git.openjdk.org/jdk/pull/29285#discussion_r2702146837
PR Review Comment: https://git.openjdk.org/jdk/pull/29285#discussion_r2702691837
PR Review Comment: https://git.openjdk.org/jdk/pull/29285#discussion_r2702693051
More information about the hotspot-runtime-dev
mailing list