Re: Cancelling parallel query leads to segfault

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: Cancelling parallel query leads to segfault
Date: 2018-02-01 22:13:06
Message-ID: eb52b99b-c4db-0b39-fea9-7c89f806a34e@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 1/27/18 22:45, Andres Freund wrote:
> I think the comment was bad, but the functionality pretty crucial. So I
> don't think
> In AtAbort_Portals(), remove the code that marks an active portal as
> failed. As the comment there already predicted, this doesn't work if
> the running command wants to keep running after transaction abort. And
> it's actually not necessary, because pquery.c is careful to run all
> portal code in a PG_TRY block and explicitly runs MarkPortalFailed() if
> there is an exception. So the code in AtAbort_Portals() is never used
> anyway.
> holds true, because FATAL errors do not follow the sigsetjmp chain.
>
> I'm uncomfortable with the idea, but without further study, it does seem
> like you might be able to largely rescue the idea by checking
> proc_exit_in_progress or similar.

Here is a patch to implement that idea. Do you have a way to test it
repeatedly, or do you just randomly cancel queries?

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
0001-Fix-crash-when-canceling-parallel-query.patch text/plain 2.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2018-02-01 22:20:19 Re: Query running for very long time (server hanged) with parallel append
Previous Message Robert Haas 2018-02-01 20:33:49 Re: Re: BUG #15039: some question about hash index code