Re: PostgreSQL ping/pong to client

From: Ajay Pratap <ajaypratap(at)drishti-soft(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PostgreSQL ping/pong to client
Date: 2019-04-17 14:39:30
Message-ID: CABi=8qwKpaXAUjQjbS=bSJq-LqEWRYCZD6C6dd3hzVyHQa2s5A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Correction: I meant when my java application dies postgres should break all
the connections that were associated with that peer.

On Wed, Apr 17, 2019, 19:59 Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> wrote:

> 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(dot)klaver(at)aklaver(dot)com
>

--

*Disclaimer:* The information in this communication is confidential and
may be legally privileged. It is intended solely for the use of the
individual or entity to whom it is addressed and others authorized to
receive it. If you are not the intended recipient you are hereby notified
that any disclosure, copying, distribution or taking action in reliance of
the contents of this information is strictly prohibited and may be
unlawful. Drishti is neither liable for the improper, incomplete
transmission of the information contained in this communication nor any
delay in its receipt. The communication is not intended to operate as an
electronic signature under any applicable law. Drishti assumes no
responsibility for any loss or damage resulting from the use of e-mails.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2019-04-17 14:48:19 Re: PostgreSQL ping/pong to client
Previous Message Adrian Klaver 2019-04-17 14:34:30 Re: Possible corrupt index?