Locking & concurrencyintermediatePro runbook

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.

ProCaptured evidence where the run produced it

Full runbook for this incident

The scenario above is free. What Pro unlocks is the fix: how to identify stop idle-in-transaction sessions from holding locks, the exact SQL to trace it, PostgreSQL 18 output for the steps we captured, the resolution path, and how to stop it recurring.
  • 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.

Compare plans

ShareLinkedInX

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.

FollowSubstackLinkedInnew errors · lab notes · hiring loops