Skip to content

CAUTION: This site hosts draft documentation for the next release. For published content of the latest release, visit www.eclipse.org/openj9/docs

-XX:[+|-]ShowCarrierFrames

Start of content that applies to Java 21 (LTS) and later This option controls the addition of the carrier threads' stack trace to the Throwable.getStackTrace() method. You can add the stack trace of the carrier threads to facilitate the debugging process.

Notes:

  • The platform thread that runs a virtual thread is that virtual thread's carrier thread.
  • The -XX:[+|-]ShowCarrierFrames option is applicable only if the current thread is a virtual thread.
  • If you specify the -XX:-StackTraceInThrowable option, the -XX:[+|-]ShowCarrierFrames option has no effect. The -XX:-StackTraceInThrowable option removes stack trace of all threads from exceptions.

Syntax

    -XX:[+|-]ShowCarrierFrames
Setting Effect Default
-XX:+ShowCarrierFrames Enable
-XX:-ShowCarrierFrames Disable yes

Explanation

Virtual threads require platform threads to run because the operating system identifies only platform threads. Therefore, a VM maintains multiple platform threads that are used as carrier threads to run the virtual threads. The VM assigns a virtual thread to a platform thread in a process called mounting.

Although the virtual thread runs on a carrier thread, the stack trace of the virtual thread and its carrier thread are separate. If an exception occurs on running the virtual threads, the thread dumps do not include stack frames from the carrier thread's stack.

You can use the -XX:+ShowCarrierFrames option to add the stack trace of the carrier thread in addition to the virtual thread stack trace to the Throwable.getStackTrace() method, if an exception occurs. End of content that applies to Java 21 (LTS) and later