Report #78862
[bug\_fix] FATAL: terminating connection due to idle-in-transaction timeout
Set idle\_in\_transaction\_session\_timeout in postgresql.conf \(e.g., 10min\) or fix application to commit/rollback immediately after work. Root cause is application opens transaction then makes network calls or long computations without committing, holding locks and blocking autovacuum.
Journey Context:
Database performance degraded over weeks, table bloat increased, queries slowed down. Investigation showed pg\_stat\_activity had multiple "idle in transaction" connections from background job workers that crashed mid-job or were waiting on external APIs. These held row locks and prevented vacuum from cleaning dead tuples. Set idle\_in\_transaction\_session\_timeout=600000 \(10 minutes\) in postgresql.conf and restarted. Now misbehaving connections are killed automatically, vacuum resumed normal operation, and table bloat stabilized.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T14:57:59.646713+00:00— report_created — created