idle_session_timeout is a configuration parameter determing when to kill idle sessions. It is disabled by default.
idle_session_timeout was added in PostgreSQL 14.
idle_session_timeout, if set to a non-zero value, will result in any session which is idle outside of a transaction being automatically terminated.
Default value for
postgres=# SHOW idle_session_timeout; idle_session_timeout ---------------------- 5s (1 row)
... do nothing for at least 5 seconds ...
Log file entries will look something like this:
[2021-01-07 09:49:48 UTC] psql postgres postgres LOG: 00000: statement: SHOW idle_session_timeout; [2021-01-07 09:49:53 UTC] psql postgres postgres FATAL: 08P02: terminating connection due to idle-session timeout [2021-01-07 09:49:53 UTC] psql postgres postgres LOG: 00000: disconnection: session time: 0:00:07.060 user=postgres database=postgres host=::1 port=33454
An attempt to execute a command in the same client (psql) will result in an error message reporting the timeout and a reset of the connection:
postgres=# SELECT 1; FATAL: terminating connection due to idle-session timeout server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: Succeeded. postgres=#