Re: BUG #12833: Cannot cancel query or terminate backend if it client is SIGSTOPed

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: eshkinkot(at)gmail(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #12833: Cannot cancel query or terminate backend if it client is SIGSTOPed
Date: 2015-03-05 17:36:42
Message-ID: 20150305173642.GT30405@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2015-03-05 12:33:22 -0500, Tom Lane wrote:
> eshkinkot(at)gmail(dot)com writes:
> > I run this command in bash:
> > $ ../bin/psql -X -At -c 'copy (select * from generate_series(1, 100000000))
> > to stdout' & ( sleep 2; kill -STOP $!; )
>
> > $ ps f --ppid $$
> > PID TTY STAT TIME COMMAND
> > 24773 pts/23 R+ 0:00 ps f --ppid 5021
> > 24685 pts/23 T 0:00 ../bin/psql -X -At -c copy (select * from
> > generate_series(1, 100000000)) to stdout
>
> > Now psql is stopped and I try to cancel it backend with
> > pg_cancel_backend and pg_terminate_backend, but it not canceled or stopped.

9.5 should allow sessions to be terminated, but not
cancelled. Unfortunately this is too big a change to be backported, so
you'll have to wait for that.

> [ shrug... ] It'll probably terminate the query whenever the kernel
> returns from send(). There aren't a lot of options here: the only
> way we could get out of this without waiting for the client is a
> catastrophic termination of the session, which is not really what
> either of those operations authorizes. There's no way to do anything
> less drastic without breaking protocol sync.

Well, terminate pretty much authorizes it, no? At least thats what we
decided in the "Escaping from blocked send() reprised." thread. If we
were blocked in a send() and asked to die we'll now do so.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message bryce2 2015-03-05 18:14:32 BUG #12834: Avoiding Disk Control Writes for better Laptop / SSD compatibility. pgstats
Previous Message Tom Lane 2015-03-05 17:33:22 Re: BUG #12833: Cannot cancel query or terminate backend if it client is SIGSTOPed