RFR: 8373297: Test com/sun/jdi/AfterThreadDeathTest.java failed with unexpected ObjectCollectedException

Serguei Spitsyn sspitsyn at openjdk.org
Wed Dec 10 11:22:25 UTC 2025


On Tue, 9 Dec 2025 22:45:17 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

> The thread object for the main thread is getting unexpectedly collected. This results in an ObjectCollectedException during the test's handling of the ThreadDeath event. It tries enabling a SingleStepRequest on the thread, but the thread an already been collected by this time since the ThreadDeath event is using the SUSPEND_NONE policy, allowing the thread to exit.
> 
> This fix is to simply call ObjectReference.disableCollection() on the main thread. It will never be collected after this point. No need to ever call enableCollection(), because the debuggee is just going to exit anyway.
> 
> Testing
> - Tier1 CI
> - Tier5 CI pruned to just run svc tests

Good.

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

Marked as reviewed by sspitsyn (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/28730#pullrequestreview-3562045796


More information about the serviceability-dev mailing list