Re: BUG #17776: Connections are terminated unexpectedly sometimes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: fran(dot)tm213(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17776: Connections are terminated unexpectedly sometimes
Date: 2023-02-06 15:39:59
Message-ID: 2665710.1675697999@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)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(at)db_production LOG: could not
> receive data from client: Connection reset by peer
> 2023-02-06 08:26:56.134 UTC [352190] user(at)db_production LOG: could not
> receive data from client: Connection reset by peer
> 2023-02-06 08:26:56.134 UTC [352191] user(at)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2023-02-06 15:43:00 Re: BUG #17767: psql: tab-completion causes warnings when standard_conforming_strings = off
Previous Message Tom Lane 2023-02-06 15:34:24 Re: exceptional result of postres_fdw external table joining local table