pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tristan Partin <tristan@neon.tech>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: dastapov@gmail.com
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17698: On SIGTERM, psql terminates, but leaves the statement running
Date: Mon, 22 May 2023 12:04:58 -0500
Message-ID: <CSSYXFI3JCDF.1RO2ES99IT2GH@c3po> (raw)
In-Reply-To: <20230116151459.fzg6mlegkcrzch4i@alvherre.pgsql>
References: <17698-58a6ab8caec496b0@postgresql.org>
	<20230116151459.fzg6mlegkcrzch4i@alvherre.pgsql>

On Mon Jan 16, 2023 at 9:14 AM CST, Alvaro Herrera wrote:
> On 2022-Nov-25, PG Bug reporting form wrote:
>
> > Reproduction: start psql, launch a query that will take a while (I
> > used 'select pg_sleep(1234)'), then from another terminal do
> > "kill -TERM <pid of psql>".  Psql would be terminated, but query would
> > not be, and will keep running until TCP timeout kicks in and kills the
> > stale connection.
> > 
> > SIGINT, on the other hand, will cause psql will terminate the current
> > statement.
> > 
> > Perhaps psql could have a SIGTERM handler that does roughly what
> > SIGINT handler does before terminating the whole process, and would
> > cancel the current statement (if any)?
>
> Sure.  I doubt we want to wait until a reply to the cancel request is
> obtained, but we could have the sigterm handler at least send it before
> terminating.

I am currently working on a patch for this.

-- 
Tristan Partin
Neon (https://neon.tech)





view thread (5+ messages)

Message-ID: <CSSYXFI3JCDF.1RO2ES99IT2GH@c3po>
Permalink:  ../CSSYXFI3JCDF.1RO2ES99IT2GH@c3po/
Also on:    postgresql.org/message-id/CSSYXFI3JCDF.1RO2ES99IT2GH@c3po

 · 

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-bugs@postgresql.org
  Cc: tristan@neon.tech, alvherre@alvh.no-ip.org, dastapov@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17698: On SIGTERM, psql terminates, but leaves the statement running
  In-Reply-To: <CSSYXFI3JCDF.1RO2ES99IT2GH@c3po>

* 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