If the debug agent includevirtualtrheads option is not set to 'y' (it is 'n' by default), then it is possible for the debug agent to start up without enabling VIRTUAL_THREAD_START/END events (currently it always enables them). However, they need to be enabled if the debugger creates any ThreadStartRequests or ThreadDeathRequests and do not include the PlatformThreadsOnly filter. Given that by default jdb and mainstream debuggers all seem to add this filter, this is unlikely to be an issue.
There is also one edge cases that debuggers may run into (jdb does). If the debugger learns about a virtual thread (like when a breakpoint is hit), it may want to track it in some sort of list. It will then need a ThreadDeathRequest to be notified when that thread can be removed from the list. If ThreadDeathRequests are enabled globally (for all threads), that would introduce performance issues. However, the debugger can instead filter the ThreadDeathRequest on just that one particular thread, so this shouldn't introduce the performance issue you would see if ThreadDeathRequests were enabled globally.
- relates to
-
JDK-8282441 [LOOM] The debug agent should attempt to free vthread ThreadNodes
-
- Resolved
-