Обсуждение: Connection Drop from PostgreSQL Database Server

Поиск
Список
Период
Сортировка

Connection Drop from PostgreSQL Database Server

От
Mohit Kumar Sahni
Дата:
I have done a setup over Azure Cloud for my PostgreSQL DB.
It's Ubuntu 18.04 LTS (4vCPU, 8GB RAM) machine with PostgreSQL 9.6 version.
The problem that occurring is, when the connection to the postgresql db stays idle for some time let's say 2 to 10
minutesthen the connection to the db does not respond such that it doesn't fulfil the request and keep processing the
query.
Same goes with my JAVA Springboot Application. The connection doesn't respond and the query keep processing.

This happens randomly such that the timing is not traceable sometimes it happens in 2 minutes, sometimes in 10 minutes
&sometimes don't. 
I have tried with PostgreSQL Configuration file parameters. I have tried:
tcp_keepalive_idle, tcp_keepalive_interval, tcp_keepalive_count.
Also statement_timeout & session_timeout parameters but it doesn't change anyway.

Thank you

Re: Connection Drop from PostgreSQL Database Server

От
Adrian Klaver
Дата:
On 3/5/19 4:19 AM, Mohit Kumar Sahni wrote:
> I have done a setup over Azure Cloud for my PostgreSQL DB.
> It's Ubuntu 18.04 LTS (4vCPU, 8GB RAM) machine with PostgreSQL 9.6 version.
> The problem that occurring is, when the connection to the postgresql db stays idle for some time let's say 2 to 10
minutesthen the connection to the db does not respond such that it doesn't fulfil the request and keep processing the
query.
> Same goes with my JAVA Springboot Application. The connection doesn't respond and the query keep processing.

Is there anything in the Postgres log that is relevant?

The same for the OS system log?

> 
> This happens randomly such that the timing is not traceable sometimes it happens in 2 minutes, sometimes in 10
minutes& sometimes don't.
 
> I have tried with PostgreSQL Configuration file parameters. I have tried:
> tcp_keepalive_idle, tcp_keepalive_interval, tcp_keepalive_count.
> Also statement_timeout & session_timeout parameters but it doesn't change anyway.

What values for the above?

> 
> Thank you
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com


Re: Connection Drop from PostgreSQL Database Server

От
Adrian Klaver
Дата:
On 3/5/19 7:13 PM, Mohit Kumar Sahni wrote:
> Hi Adrian,
> 
> I have checked my log files. Here are some of the lines that I think were logged at the time of connection drop:
> 2019-03-03 15:57:33.444 UTC [7146] azpostgres@master_configuration_db LOG:  could not receive data from client:
Connectiontimed out
 
> 2019-03-03 15:57:33.444 UTC [13161] azpostgres@master_configuration_db LOG:  could not receive data from client:
Connectiontimed out
 
> 2019-03-03 15:57:33.444 UTC [7571] azpostgres@master_configuration_db LOG:  could not receive data from client:
Connectiontimed out
 
> 2019-03-03 15:57:33.446 UTC [14459] azpostgres@master_configuration_db LOG:  could not receive data from client:
Connectiontimed out
 
> 2019-03-03 15:57:33.448 UTC [18010] azpostgres@postgres LOG:  could not receive data from client: Connection timed
out

Where is the client running relative to the server?

Does Azure Cloud have a timeout set for connections?

> 
> And for the parameters, I have tried following values:
> 1. tcp_keepalive_idle: 10000 & 2700
> 2. tcp_keepalive_interval: 10000 & 2600
> 3. tcp_keepalive_count: 0 & 1
> 4. session_timeout: 20000
> 
> All the values couldn't solve the problem.
> 
> Thanks
> Mohit Kumar Sahni
> 
> ________________________________________
> From: Adrian Klaver <adrian.klaver@aklaver.com>
> Sent: Wednesday, March 6, 2019 6:19 AM
> To: Mohit Kumar Sahni; pgsql-general@lists.postgresql.org
> Cc: Maneesh Kumar Singh
> Subject: Re: Connection Drop from PostgreSQL Database Server
> 
> On 3/5/19 4:19 AM, Mohit Kumar Sahni wrote:
>> I have done a setup over Azure Cloud for my PostgreSQL DB.
>> It's Ubuntu 18.04 LTS (4vCPU, 8GB RAM) machine with PostgreSQL 9.6 version.
>> The problem that occurring is, when the connection to the postgresql db stays idle for some time let's say 2 to 10
minutesthen the connection to the db does not respond such that it doesn't fulfil the request and keep processing the
query.
>> Same goes with my JAVA Springboot Application. The connection doesn't respond and the query keep processing.
> 
> Is there anything in the Postgres log that is relevant?
> 
> The same for the OS system log?
> 
>>
>> This happens randomly such that the timing is not traceable sometimes it happens in 2 minutes, sometimes in 10
minutes& sometimes don't.
 
>> I have tried with PostgreSQL Configuration file parameters. I have tried:
>> tcp_keepalive_idle, tcp_keepalive_interval, tcp_keepalive_count.
>> Also statement_timeout & session_timeout parameters but it doesn't change anyway.
> 
> What values for the above?
> 
>>
>> Thank you
>>
> 
> 
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com