RFR: 8373102: com/sun/jdi/MethodInvokeWithTraceOnTest.java can fail with ObjectCollectedException when run with a small heap
Chris Plummer
cjplummer at openjdk.org
Thu Dec 4 21:06:15 UTC 2025
With JDI tracing enabled, an attempt to trace an event when using SUSPEND_NONE can result in an ObjectCollectedException because the thread is still running and objects that are part of the trace can be collected already. In this case were were dealing with trying to print the thread name for a VirtualThreadEndEvent, and the virtual thread has already exited and been gc'd.
Tested by running test case before change (verified failure) and after change (50 runs without a failure). Will also run tier1 and tier5 svc just to be sure.
-------------
Commit messages:
- fix minor typo in comment
- fix minor typo in comment
- handle ObjectCollectedException
Changes: https://git.openjdk.org/jdk/pull/28666/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28666&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8373102
Stats: 7 lines in 2 files changed: 4 ins; 1 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/28666.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/28666/head:pull/28666
PR: https://git.openjdk.org/jdk/pull/28666
More information about the serviceability-dev
mailing list