Re: BUG #17776: Connections are terminated unexpectedly sometimes - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #17776: Connections are terminated unexpectedly sometimes
Date
Msg-id 2665710.1675697999@sss.pgh.pa.us
Whole thread Raw
In response to BUG #17776: Connections are terminated unexpectedly sometimes  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #17776: Connections are terminated unexpectedly sometimes
List pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> I am running Ruby on Rails app with postgresql 14.6 on ubuntu 20.
> For some reason, the connections are terminated unexpectedly while running a
> background job.
> Regarding background job, it requires around 100~200 connections over
> 6~7hrs.
> I've checked postgresql log around that time.
> 2023-02-06 06:45:41.702 UTC [341438] user@db_production LOG:  could not
> receive data from client: Connection reset by peer
> 2023-02-06 08:26:56.134 UTC [352190] user@db_production LOG:  could not
> receive data from client: Connection reset by peer
> 2023-02-06 08:26:56.134 UTC [352191] user@db_production LOG:  could not
> receive data from client: Connection reset by peer

Looks like something in your network infrastructure is timing out
and dropping idle connections too quickly.  If you can't fix the
actual problem, Postgres' TCP-timeout settings might provide a
workaround by maintaining an illusion that the connection is
busy.  See

 tcp_keepalives_count
 tcp_keepalives_idle
 tcp_keepalives_interval
 tcp_user_timeout

            regards, tom lane



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: exceptional result of postres_fdw external table joining local table
Next
From: Alvaro Herrera
Date:
Subject: Re: BUG #17767: psql: tab-completion causes warnings when standard_conforming_strings = off