Stop idle-in-transaction sessions from holding locks
A session that opens a transaction, does one write, then sits idle keeps its locks the whole time. idle_in_transaction_session_timeout reaps it automatically, the short-leash session count drops from 1 to 0.
Problem
What you're actually looking at
The symptom as it shows up on a real server.
An 'idle in transaction' session has done some work but not committed. It keeps every lock and holds back vacuum, indefinitely, while doing nothing. The clean fix is a timeout that terminates such sessions automatically.
Meridian's reconcile_worker updated a ledger row and then stalled, idle in transaction, still holding row locks. Rather than hunt it down by hand, a timeout should reap it.
Simple terms
A session that opens a transaction, makes one change, and then just sits there keeps every lock it took the entire time, and holds back vacuum too, all while doing nothing. Hunting these down by hand is thankless. Setting idle_in_transaction_session_timeout tells PostgreSQL to automatically end any session that stays idle inside a transaction too long, so one forgotten transaction cannot hold the database hostage.
Full runbook for this incident
- The full identify checklist, the exact signals that tell you it's this incident
- Every diagnostic query; lab output is attached only to the steps we actually captured
- The resolution path and the pitfalls that make it worse
- Mitigation steps to stop it recurring, plus a verify-you're-done query
Card required. Cancel before day 7 and you are not charged.
More in this category
Other Locking & concurrency runbooks
Neighbouring incidents that share the same diagnostic surface.
Connected
How this connects to the rest of the library
A live view of this page's real cross-references, what explains it, what fixes it, what to tune, and where to go next. Every link is an authored relationship, not a guess.
Need the full procedure?
Pro runbooks finish the incident path
Free runbooks teach the shape. Pro opens the full step transcript, edge cases, and prevention depth.