Error 57P05 signals PostgreSQL terminated your session because it was idle longer than idle_session_timeout.
PostgreSQL Error 57P05 (idle_session_timeout) occurs when the server kills a session that has been inactive beyond the idle_session_timeout setting. Lower the timeout or keep the session active, or unset the parameter to resolve the issue.
PostgreSQL Error 57P05
Error 57P05 appears when PostgreSQL ends a client connection that remained inactive longer than the idle_session_timeout parameter. The server sends SQLSTATE 57P05 with condition name idle_session_timeout and forcibly closes the socket.
The setting was introduced in PostgreSQL 14 to free resources held by forgotten sessions.
While helpful for stability, it surprises applications that expect persistent connections.
The timeout fires when a backend is in Idle state, meaning it is not inside a transaction and has not executed a statement for the configured interval. Any read or write resets the counter.
Values can be set in postgresql.conf, ALTER SYSTEM, ALTER ROLE, or SET for the current session.
Low values like 60 s often collide with long-lived pools.
Increase or disable idle_session_timeout at the server, role, database, or session level. Zero disables the feature. Restart or reload is required for postgresql.conf changes.
Alternatively, modify the client or connection pool to issue lightweight KEEPALIVE queries such as SELECT 1; before the timeout elapses.
Connection poolers (PgBouncer, JDBC, psycopg2 pool) with min sessions idle longer than 5 minutes will hit the default 10 minute timeout.
Raise the timeout to match pool settings.
Automated ETL jobs that open a connection, sleep, then submit work will lose the session. Refactor to reopen connections on demand or wrap sleep in an explicit transaction.
Set idle_session_timeout to a value higher than the longest expected idle period. Monitor pg_stat_activity to spot idle sessions and tune proactively.
Use application-level keepalives or connection pooling libraries that send periodic queries.
Document timeout settings in Galaxy Collections so teammates reuse the safe defaults.
Error 57P02 (admin_shutdown) occurs when the server is shutting down and also terminates sessions. Unlike idle_session_timeout, it is not configurable and is triggered by a stop command.
Error 53300 (too_many_connections) signals new sessions are blocked when max_connections is reached, often because old idle sessions were not timed out. Raising idle_session_timeout can help prevent it.
.
No. The timer pauses during an active transaction and resumes when the session returns to Idle state.
Not if you use ALTER SYSTEM or reload. Editing postgresql.conf directly requires a reload, not a full restart.
statement_timeout limits the runtime of a single query. idle_session_timeout limits inactivity between queries.
Yes. Galaxy’s live query history highlights Idle sessions in pg_stat_activity and lets teams set and share optimal timeout values in endorsed queries.