On Thu, 4 Dec 2025 21:00:41 GMT, Chris Plummer <[email protected]> wrote:
> 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. > > I think better solution would be to catch `ObjectCollectedException` in > > `EventSetImpl.toString` implementations (and print al least event name). > > But it might not be worth the effort, so it's up to you > > I think your suggesting to implement it in all of the Event subclasses > implemented as inner classes of EventSetImpl, right? It would be more complete solution, but even fixing only `EventSetImpl.toString` (for each event, printing event name (or class name of the event) + "<got ObjectCollectedException>" on the exception ) should be good enough ------------- PR Comment: https://git.openjdk.org/jdk/pull/28666#issuecomment-3614827467
