On Tue, 25 Nov 2025 09:09:50 GMT, Serguei Spitsyn <[email protected]> wrote:
>> Don't enabled VIRTUAL_THREAD_START/END events unless absolutely necessary.
>> Solves performance issues when trying to debug apps that create a lot of
>> virtual threads. Details in first comment.
>>
>> With these changes the Skynet benchmark no longer shows any slowdown when
>> launching with debugging enabled or when attaching the debugger.
>>
>> Tested with all tier2, tier3, tier5, and tier6 CI testing (with filters to
>> only run svc tests).
>
> src/jdk.jdwp.agent/share/native/libjdwp/eventFilter.c line 1444:
>
>> 1442: } else {
>> 1443: error = threadControl_setEventMode(JVMTI_DISABLE,
>> EI_VIRTUAL_THREAD_END, thread);
>> 1444: }
>
> Q: Why is the `THREAD_START` event disabled globally (for all threads) but
> the `THREAD_END` event is disabled for specific thread?
THREAD_START can't have a thread filter. THREAD_END can. "thread" ==
requestThread(node) == the thread filter if there is one, so when disabling
THREAD_START it could be an actual thread or it could just be NULL. For
THREAD_START "thread" should always be NULL, so I suppose I could have just
asserted that and used "thread" as the argument instead of "NULL".
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28485#discussion_r2560664560