Read a real result
Captured on 2026-09-27 (UTC+08) on a local KingbaseES V008R006C009B0014 primary, database test, using ~/kbdiag built from Go source commit 93bf65d (static linux/amd64 binary). This is lab evidence, not production validation. PIDs, counts and timings belong to this capture only. The idle-in-transaction session was created by a fault-injection script. The warning threshold was lowered to 5 seconds with --idle-in-txn-warn 5 so the example did not have to wait the default 300.
Command and output
Line by line
- First line: the command (
sessions), the verdict (WARN) and the context: server version, role (primary),user@location(localis the socket) and when the data was collected. - Finding:
[WARN], then a stable id (session.idle_in_txn), then the symptom: session 1049818 has been idle in transaction for 9 seconds. Scripts should rely on the id and the JSON fields; the wording of a symptom may change. verify:the next command to run and why. Here: look at session 1049818 to see which locks it holds and whether it blocks anyone. Afix:line, when present, is a statement for you to review; kbdiag never runs it.- Data: laid out for reading.
connectedcounts the client sessions by user, database, application and client.not idlelists the ones doing something or holding a transaction open, longest transaction first.-is null;?would be a value this account may not see. - The
esreprow is repmgr’s own query, caught while it ran. Idle sessions and background processes are only counted in the headings;--alllists them. - Exit code 1: WARN, meaning nothing is broken yet but it will be if left alone. A FAIL (the application is already affected) would be 2, UNKNOWN 3.
The same report in JSON
--json carries the same content with stable field names. This is the findings array of ~/kbdiag sessions --idle-in-txn-warn 5 --json, taken a moment later:
The full report also has:
command,verdictandcontext.data: each probe with itsstatus,columns,rowsandtruncated. JSON keeps raw values (seconds, bytes, full SQL) and always carries every session, idle ones and background processes included. Here that is 12 rows, where the text lists 2.redacted: the fields the account was not allowed to see.
The exit code is the same as in text mode.
What happened next
The injected session was released and a follow-up check found no test sessions left. In a real case, run the verify command and decide with the application owner whether the transaction should be committed, rolled back or the connection closed.
Investigate lock waits · Back to your first check