system-threads
Retrieves the stack traces and lock status of all system threads. Requires cluster administrator privileges.
Command properties
| Property | Description |
|---|---|
| Command type | Driver query |
| Required permission | Cluster administrator |
| License usage | Not counted |
| Parallel execution | Not supported |
| Distributed execution | Not supported |
Syntax
Options
prettystack=BOOL- Formats the stack trace in a human-readable form (default:
t).
t: Converts the stack trace to a string in the same format as jstack.f: Returns the stack trace as an array of maps containing class, file, line number, and method information.
stack=BOOL- Retrieves stack traces (default:
t).
t: Uses JMX ThreadMXBean to retrieve thread stack traces and lock information.f: Returns only thread ID, name, and state without fetching stack traces.
Output fields
| Field | Type | Description |
|---|---|---|
| tid | long | Thread ID |
| name | string | Thread name |
| state | string | Thread state. One of: NEW, RUNNABLE, BLOCKED, WAITING, TIMED_WAITING, TERMINATED |
| stacktrace | string | Thread stack trace (same format as jstack). Not returned when stack=f. |
Error codes
Parsing errors
| Error code | Message | Description |
|---|---|---|
| 95040 | 읽기 권한이 없습니다. 클러스터 관리자 권한이 필요합니다. | The user does not have cluster administrator privileges |
| 92004 | 잘못된 옵션 값입니다: [option]=[value] | A non-boolean value was specified for the prettystack or stack option |
Runtime errors
N/A
Description
The system-threads command retrieves stack traces and lock status for all threads in the JVM. Use it to examine thread dumps during incident analysis or performance diagnostics.
When stack=t (the default), thread information and stack traces are retrieved together through JMX ThreadMXBean. When prettystack=t (the default), the result is converted to a jstack-format string that includes lock information. When prettystack=f, the stack trace is returned as an array of maps containing class, file, line number, and method information.
When stack=f, only the thread list is retrieved without stack traces. This is useful when you need to quickly check thread states without collecting stack traces.
Cluster administrator privileges are required to run this command.
Examples
-
Retrieve a full thread dump
system-threadsRetrieves the stack traces and lock status of all threads in the system.
-
Retrieve thread list without stack traces
system-threads stack=fReturns only thread ID, name, and state. Runs faster because stack traces are not collected.
-
Retrieve stack traces as an array
system-threads prettystack=fReturns the stack trace as an array of maps containing class, file, line number, and method information.
-
Filter for BLOCKED threads
system-threads | search state == "BLOCKED"Retrieves the thread dump and filters for threads in the BLOCKED state.