RFR: 8367614: Test vmTestbase/nsk/jdi/stress/serial/heapwalking001/TestDescription.java failed, passed and timed-out
Chris Plummer
cjplummer at openjdk.org
Wed Sep 17 03:10:43 UTC 2025
This test has been silently throwing ObjectCollectedException probably but still passing. I believe it has always done this. The exception went unnoticed because it is caught and then setSuccess(false) is never called. It was finally noticed when this test failed due to a timeout (which seems to be a separate issue), and the ObjectCollectedException was noted in the log.
This PR fixes the setSuccess(false) call in a few places, including in one other test that didn't seem to be otherwise be failing.
The cause of the ObjectCollectedException is a test bug. The test is testing the following:
// can't force collection of thread group because of 1 reference is always
// left in parent tread group
So it forces a GC and expects the ObjectReference it has for a ThreadGroup to still be alive. However, the above comment is incorrect. The ThreadGroup spec says:
"A thread group is weakly reachable from its parent group so that it is eligible for garbage collection when there are no live threads in the group and the thread group is otherwise unreachable. "
So this ThreadGroup is being collected, resulting in the ObjectCollectedException in the following code:
for (ObjectReference objectReference : objectReferences)
objectReference.referringObjects(0);
This part of the test is invalid and has been removed. I also slightly updated the rest of the test by forcing a gc earlier so we can verify that the ThreadGroup is collected.
-------------
Commit messages:
- fix minor typo
- fix bugs
Changes: https://git.openjdk.org/jdk/pull/27327/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27327&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8367614
Stats: 57 lines in 2 files changed: 12 ins; 34 del; 11 mod
Patch: https://git.openjdk.org/jdk/pull/27327.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/27327/head:pull/27327
PR: https://git.openjdk.org/jdk/pull/27327
More information about the serviceability-dev
mailing list