RFR: 8371380: [LOOM] The debug agent should avoid enabling VIRTUAL_THREAD_START/END events when possible
Alex Menkov
amenkov at openjdk.org
Wed Nov 26 22:48:52 UTC 2025
On Tue, 25 Nov 2025 02:25:02 GMT, Chris Plummer <cjplummer at openjdk.org> 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 1296:
> 1294: {
> 1295: jvmtiError error = JVMTI_ERROR_NONE;
> 1296: int ei = NODE_EI(node);
Suggestion:
EventIndex ei = NODE_EI(node);
src/jdk.jdwp.agent/share/native/libjdwp/eventFilter.c line 1394:
> 1392: jvmtiError error2 = JVMTI_ERROR_NONE;
> 1393: jthread thread;
> 1394: int ei = NODE_EI(node);
Suggestion:
EventIndex ei = NODE_EI(node);
src/jdk.jdwp.agent/share/native/libjdwp/eventHandler.c line 1691:
> 1689: * a deferred event request.
> 1690: */
> 1691: if (gdata->virtualThreadStartEventsPermanentlyEnabled) {
Looks like this block can disable VITRUAL_THREAD_START when `rememberVThreadsWhenDisconnected` is set.
src/jdk.jdwp.agent/share/native/libjdwp/util.h line 90:
> 88: jboolean includeVThreads; /* If true, VM.AllThreads includes vthreads. */
> 89: jboolean rememberVThreadsWhenDisconnected;
> 90: jboolean virtualThreadStartEventsPermanentlyEnabled;
Could you please add description for this 2 flags (and maybe `vthreadsSupported` description also can be enhanced to see relations between the flags)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28485#discussion_r2561596843
PR Review Comment: https://git.openjdk.org/jdk/pull/28485#discussion_r2561664461
PR Review Comment: https://git.openjdk.org/jdk/pull/28485#discussion_r2566654961
PR Review Comment: https://git.openjdk.org/jdk/pull/28485#discussion_r2566662313
More information about the serviceability-dev
mailing list