Problem 01
What does 2501 do when PostgreSQL runs out of connections?#
It measures connection use against the limit, finds the long-running queries, blocking chains and sessions stuck idle in transaction, and frees them the gentle way first: cancel before terminate. A follow-up query proves the new state.
It checks
- Connections in use against the configured maximum.
- Long-running queries, blocking chains and idle-in-transaction sessions.
- Whether the node is a primary or a replica.
It may
- Cancel a stuck session, and terminate it only if the cancel did not free the lock.
- Set a connection limit on service roles.
It leaves to people
- Changes to postgresql.conf or pg_hba.conf, and any reload or restart.
- Anything where the root cause is unclear.

