The following are issues with the new thread dump (jcmd Thread.dump_to_file) that should be examined.
1. The thread dump does not include virtual threads created directly with the Thread API. Should the default setting of jdk.trackAllThreads be changed to true to avoid surprises?
2. jcmd Thread.dump_to_file requires a file to be specified. Some users may want the output generated to stdout, possible by specifying the file as "-" but it limits the output to about 16k so will appear truncated when there are huge number of threads. Should this be re-visited to default to stdout if a file is not specified? Could an OutputStream could be created that is backed by the pipe connection to the tool so that the output doesn't need to be buffered off-heap?
3. jcmd Thread.dump_to_file triggers the Attach Listener thread in the target VM to generate the thread dump. The Attach Listener is a daemon thread so does not prevent the VM from exiting. Should this command prevent the VM from exiting? The issue dates back to JDK 6 but may not have been noticed because other Java commands executed by the Attach Listener are short lived.
4. The JSON format should be documented somewhere. It should also have a version element to allow the format to be updated going forward.
1. The thread dump does not include virtual threads created directly with the Thread API. Should the default setting of jdk.trackAllThreads be changed to true to avoid surprises?
2. jcmd Thread.dump_to_file requires a file to be specified. Some users may want the output generated to stdout, possible by specifying the file as "-" but it limits the output to about 16k so will appear truncated when there are huge number of threads. Should this be re-visited to default to stdout if a file is not specified? Could an OutputStream could be created that is backed by the pipe connection to the tool so that the output doesn't need to be buffered off-heap?
3. jcmd Thread.dump_to_file triggers the Attach Listener thread in the target VM to generate the thread dump. The Attach Listener is a daemon thread so does not prevent the VM from exiting. Should this command prevent the VM from exiting? The issue dates back to JDK 6 but may not have been noticed because other Java commands executed by the Attach Listener are short lived.
4. The JSON format should be documented somewhere. It should also have a version element to allow the format to be updated going forward.
- relates to
-
JDK-8302184 full lock information for virtual threads in thread dumps
- Open
-
JDK-8287008 Improve tests for thread dumps in JSON format
- Resolved
-
JDK-8302185 jdk.trackAllThreads should be enabled by default
- Closed
1.
|
Document format of thread dump in JSON format | In Progress | Alan Bateman |