You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When run in a swarm (not: standalone container), idle connections to the database get dropped after 900 seconds. Hitting all applications that have long-idling connections.
To try out:
Start database container in swarm, expose port
Connect via psql from the host
Do nothing for > 900 seconds
Send some query. Will fail due to broken connection.
This is a timeout in the system drivers below vip endpoint_mode. It goes away in endpoint_mode of dnsrr, but that does not work with exposed ports. One fix is to setup net.ipv4.tcp_keepalive_time on the host to something below 900 seconds. But not everyone can do that.
One other fix that seems to work is to replace the default launch command to something like this:
When run in a swarm (not: standalone container), idle connections to the database get dropped after 900 seconds. Hitting all applications that have long-idling connections.
To try out:
This is a timeout in the system drivers below vip endpoint_mode. It goes away in endpoint_mode of dnsrr, but that does not work with exposed ports. One fix is to setup net.ipv4.tcp_keepalive_time on the host to something below 900 seconds. But not everyone can do that.
One other fix that seems to work is to replace the default launch command to something like this:
(docker-compose.yml):
mydb:
image: ...
command: postgres -c tcp_keepalives_idle=600 -c tcp_keepalives_interval=60 -c tcp_keepalives_count=60
Maybe add this note to documentation. It is annoying for someone new to postgres in docker.
The text was updated successfully, but these errors were encountered: