PG Bug reporting form <noreply@postgresql.org> writes:
> Query running for more than 30 minutes are disconnected
> SELECT pg_sleep(1820)
> SSL SYSCALL error: EOF detected
Ideally, you'd fix your broken network infrastructure. However,
if you can't ...
> Increased timeouts tcp_user_timeout, tcp_keepalives_interval didn't help.
... that's exactly backwards about how to work around it. You need
to *reduce* the interval at which keepalives are sent. Try setting
tcp_keepalives_idle to 10min or so. (At least on my Linux box,
it seems to default to 7200s = 2 hours, so that it's no surprise that a
router that drops connections after 30 minutes would cause problems.)
regards, tom lane