Connection to PostgreSQL disconnects every hour regardless of activity I'm monitoring my PostgreSQL clients using a periodic netstat -an | grep 5432 | grep EST to check the ESTABLISHED status of the connection every 5 minutes. I have noticed that all of the connections become TIME_WAIT after around minutes, and then a new connection is re-opened (the client port changes), forming a new ESTABLISHED connection. This behavior persists regardless of the status or activity of the postgres client.

Any thoughts on what might be causing this recurring reconnection on the clients? I've tried setting the tcp_keepalives_idle to no avail.
Turns out, it uses a connection pool by HikariCP. The default behavior of the maxLifetime and idleTimeout configurations are causing the reconnection. Setting both configurations to 0 disables them and removes the reconnecting issue.

Shoutout to this comment for helping me understand my problem.