pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stas Kelvich <s.kelvich@postgrespro.ru>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Tatsuo Ishii <ishii@sraoss.co.jp>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Add client connection check during the execution of the query
Date: Fri, 5 Jul 2019 15:27:06 +0300
Message-ID: <37D9769E-2991-46A9-A65B-498E3CF55D8C@postgrespro.ru> (raw)
In-Reply-To: <CA+hUKG+TGsHUZ4S6QOXr_ueKJ9-8d-TaoDpk9zdgjB_vHqotzQ@mail.gmail.com>
References: <77def86b27e41f0efcba411460e929ae@postgrespro.ru>
	<19003.1547420739@sss.pgh.pa.us>
	<e2575e5bd3dbbf7c81d36ffc89a82cb9@postgrespro.ru>
	<20190705.152814.526451304812431065.t-ishii@sraoss.co.jp>
	<CA+hUKG+TGsHUZ4S6QOXr_ueKJ9-8d-TaoDpk9zdgjB_vHqotzQ@mail.gmail.com>



> On 5 Jul 2019, at 11:46, Thomas Munro <thomas.munro@gmail.com> wrote:
> 
> On Fri, Jul 5, 2019 at 6:28 PM Tatsuo Ishii <ishii@sraoss.co.jp> wrote:
>>> The purpose of this patch is to stop the execution of continuous
>>> requests in case of a disconnection from the client.
>> 
>> Pgpool-II already does this by sending a parameter status message to
>> the client. It is expected that clients are always prepared to receive
>> the parameter status message. This way I believe we could reliably
>> detect that the connection to the client is broken or not.
> 
> Hmm.  If you send a message, it's basically application-level
> keepalive.  But it's a lot harder to be sure that the protocol and
> socket are in the right state to insert a message at every possible
> CHECK_FOR_INTERRUPT() location.  Sergey's proposal of recv(MSG_PEEK)
> doesn't require any knowledge of the protocol at all, though it
> probably does need TCP keepalive to be configured to be useful for
> remote connections.


Well, indeed in case of cable disconnect only way to detect it with
proposed approach is to have tcp keepalive. However if disconnection
happens due to client application shutdown then client OS should itself
properly close than connection and therefore this patch will detect
such situation without keepalives configured.

--
Stas Kelvich
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company







view thread (54+ messages)  latest in thread

Message-ID: <37D9769E-2991-46A9-A65B-498E3CF55D8C@postgrespro.ru>
Permalink:  ../37D9769E-2991-46A9-A65B-498E3CF55D8C@postgrespro.ru/
Also on:    postgresql.org/message-id/37D9769E-2991-46A9-A65B-498E3CF55D8C@postgrespro.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: s.kelvich@postgrespro.ru, thomas.munro@gmail.com, ishii@sraoss.co.jp, tgl@sss.pgh.pa.us
  Subject: Re: Add client connection check during the execution of the query
  In-Reply-To: <37D9769E-2991-46A9-A65B-498E3CF55D8C@postgrespro.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox