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:[+|-]ShowUnmountedThreadStacks

Start of content that applies to Java 21 (LTS) and later This option enables or disables the inclusion of the unmounted virtual thread stacks in a Java™ core file.

Syntax

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

Explanation

In a VM, Java™ threads are mapped one-to-one to platform threads and each thread is allocated a new native Java stack.

Virtual threads require platform threads to run because the operating system identifies only platform threads, but these virtual threads are not tied one-to-one to a platform thread. The VM mounts the virtual threads on available platform threads, called carrier threads. When the VM faces a blocking operation on a virtual thread, the thread is unmounted from its carrier thread and hence, the virtual thread is no longer mapped to a platform thread.

Java core file lists stacks of only those threads that are mapped to platform threads. Therefore, the stack of any unmounted virtual thread is not included in the Java core file and thus, the virtual thread information remains incomplete. The unmounted threads also include the carrier thread if a virtual thread was mounted on it. Unmounting the virtual thread, unmounts the carrier thread itself. The stack of any unmounted carrier thread is also not included in the Java core file.

You can use the -XX:+ShowUnmountedThreadStacks option to include all the thread data that a VM is aware of, both regular Java threads and the unmounted threads, in the Java core file.

The -XX:-ShowUnmountedThreadStacks option is the default option because the chance of having issues with unmounted virtual threads is low. Usually the running or mounted threads are what causes failures. Including the unmounted virtual thread information increases the Java core file size and that might affect performance. End of content that applies to Java 21 (LTS) and later

See also