SQLSTATE 57P05 FATAL Class 57: Operator Intervention

idle_session_timeout terminating connection due to idle-session timeout — 57P05

PostgreSQL error “terminating connection due to idle-session timeout — 57P05” (SQLSTATE 57P05): what it means, common causes, and how to fix it.

PG 14, 15, 16, 17, 18 Official docs
Last reviewed Jun 2026 Grounded in source

Diagnostic Queries

Symptoms

A session was terminated because it sat idle (not in a transaction) longer than idle_session_timeout. PostgreSQL raises SQLSTATE 57P05 (idle_session_timeout).

  • An idle connection exceeded idle_session_timeout.
  • PostgreSQL closed it to reclaim the slot.
  • Distinct from idle-in-transaction timeout.

What the server log shows

FATAL:  terminating connection due to idle-session timeout

Why PostgreSQL raises this — what the manual says

Section 19.11.1 Statement Behavior (idle_session_timeout):

“Terminate any session that has been idle (that is, waiting for a client query), but not within an open transaction, for longer than the specified amount of time.”

idle_session_timeout reclaims connections left idle (outside any transaction) beyond the limit, freeing connection slots. Sessions exceeding it are terminated with 57P05.

Common causes

  • Connections left open and unused by the application.
  • A pooler holding idle connections past the timeout.
  • The timeout set lower than the pool’s idle period.

Relevant GUC parameters

Parameter Default Effect
idle_session_timeout 0 Terminate sessions idle (outside a transaction) beyond this; 0 disables.

How to fix it

  1. Let the pooler reconnect; ensure it handles closed idle connections.
  2. Tune the timeout above the pool’s idle period if disconnects are disruptive.
  3. Reduce idle connections held by the application.

Related & next steps

Reference: PostgreSQL 18 Section 20.10 “Client Connection Defaults”.

Was this helpful?