• Home
    • View
    • Login
    This page
    • Normal
    • Export PDF
    • Page Information

    Loading...
  1. Dashboard
  2. Undefined Space
  3. Loom
  4. Notes for debugger maintainers

Notes for debugger maintainers

  • Created by Alan Bateman, last modified on Mar 15, 2021

Enumerating Threads

Virtual threads are just objects in the heap, there may be millions of them. There is no API support for enumerating all virtual threads.

JDI VirtualThreads.allThreads (and JDWP VirtualMachine/AllThreads) continue to enumerate all platform threads.

Thread groups

Virtual threads are not active members of a thread group. 

JDI ThreadGroupReference::threads (and JDWP ThreadGroupReference/Children) continue to enumerate all platform threads in the group.

ThreadStart/ThreadEnd events

JDWP EventRequest/Set defines a new modifier VirtualThreadsExclude that can be used when requesting event kinds THREAD_START and THREAD_END to filer those events for virtual threads.

JDI ThreadStartRequest/ThreadDeathRequest define a new method removeVirtualThreadFilter that can be used to remove the filtering of thread start/end events for virtual threads. This may be changed so that JDI clients opt-in to filter rather than opt-out.

Not Supported

The following are not currently supported for virtual threads:

  • JDI ThreadReference.stop
  • JDI ThreadReference.interrupt
  • JDI ThreadReference.popFrame
  • JDI ThreadReference.forceEarlyReturn
  • JDI StackFrame.setValue

JDWP agent options

As a temporary solution to allow existing debuggers work with virtual threads, the JDWP agent will track virtual threads so they can be enumerated for debuggers that want to enumerate all virtual threads. The options that control this behaviour are:

Option Name and ValueDescriptionDefault
trackvthreads=some|all  track some or all vthreads some
enumeratevthreads=y|n    thread lists include vthreadsy
fakevthreadstartevent=y|n  send fake start event when needed y
  • enumeratevthreads control whether or not virtual threads are included in list of threads returned by JDWP VirtualThread/AllThreads and ThreadGroupReference/Children commands.
  • trackvthreads controls which virtual threads will be returned when enumeratevthreads=y.
  • fakevthreadstartevent is independent of the two others. If y, then before sending an event, send a fake THREAD_START event for if the debugger hasn’t already been notified about the virtual thread that the event occurs on. Note currently there is a bug, and if trackvthreads=all, no fake THREAD_START will ever be sent. This is only an issue if the debug agent is started after some virtual threads have been created.
Overview
Content Tools
ThemeBuilder
  • No labels

Terms of Use
• License: GPLv2
• Privacy • Trademarks • Contact Us

Powered by a free Atlassian Confluence Open Source Project License granted to https://www.atlassian.com/software/views/opensource-community-additional-license-offer. Evaluate Confluence today.

  • Kolekti ThemeBuilder Powered by Atlassian Confluence 8.5.21
  • Kolekti ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Kolekti ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 169, "requestCorrelationId": "368af6047e6f66d5"}