- Loading...
The current prototype has rudimentary support for reporting when a thread is pinned, say when a virtual thread parks while owning a monitor or with a native frame on the stack. This reporting is enabled by running with the system property jdk.tracePinnedThreads set on the command line.
Running with -Djdk.tracePinnedThreads (or -Djdk.tracePinnedThreads=full) will print a complete stack trace of the virtual thread. Native frames, synchronized frames, or frames with synchronized blocks will be highlighted in the output.
Running with -Djdk.tracePinnedThreads=short will print a "short" stack trace that includes only frames with problematic code.
The reporting does filtering to reduce output to avoid the same stack trace being reported repeatedly.
For now, traditional thread dumps do not include virtual threads. If the thread dump is taken when a virtual thread is mounted then its stack will be shown in the stack trace of its carrier thread.
The current prototype has an alternative thread dump that includes all platform threads plus all virtual threads started Twith a thread Executor (Executors.newVirtualThreadExector or Executors.newThreadExector). The thread dump is generated to a file in JSON format. The thread dump can be generated programmatically with ThreadMXBean or with the jcmd tool
jcmd <pid> Thread.dump_to_json_file <file>