Re: PostgreSQL ping/pong to client - Mailing list pgsql-general

From Adrian Klaver
Subject Re: PostgreSQL ping/pong to client
Date
Msg-id 70c44319-1ff8-8d26-ceba-db2b20d8496d@aklaver.com
Whole thread Raw
In response to PostgreSQL ping/pong to client  (Ajay Pratap <ajaypratap@drishti-soft.com>)
Responses Re: PostgreSQL ping/pong to client  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: PostgreSQL ping/pong to client  (Ajay Pratap <ajaypratap@drishti-soft.com>)
List pgsql-general
On 4/17/19 5:39 AM, Ajay Pratap wrote:
> Hello there,
> I am using PostgreSQL 10.7 as the database, and have Java web app. My 
> app takes a lock on the database using the following command whenever my 
> server is starting.
> /select /pg_try_advisory_lock/(100)/
> To make sure only one instance of the App is using the database at a time.
> There have been several instances when my server crashes(or stops/ or 
> kill), but this lock still remained on the PostgreSQL. Ideally, this 
> should not happen because TCP connection breaks if one of the peers 
> dies, but it happens otherwise.

If the server is exiting uncleanly I am not sure how it will gracefully 
close connections.

> To solve this problem PostgreSQL needs to break the connection if the 
> client dies.

But the problem as you describe it is that the server dies not the client.

> One of the methods is to configure TCP timeout but since this is very 
> impactful and hence unrealistic.
> I was wounding how can out of the box PostgreSQL help me solve this.
> May be like a ping pong service to check if client is still alive.
> 
> Thanks and regards,
> Ajay Pratap,
> Software Engineer,
> Drishti-Soft
> 
> 



-- 
Adrian Klaver
adrian.klaver@aklaver.com



pgsql-general by date:

Previous
From: Zahir Lalani
Date:
Subject: RE: Possible corrupt index?
Next
From: Adrian Klaver
Date:
Subject: Re: Possible corrupt index?