From: Alexander Lakhin <exclusion@gmail.com>
To: Magnus Hagander <magnus@hagander.net>
To: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15492: pg_cancel_backend(pg_backend_pid()) returns true sporadically
Date: Mon, 12 Nov 2018 06:40:00 +0300
Message-ID: <a5b57f72-f0d4-38d0-9a26-a03eacf4f6ae@gmail.com> (raw)
In-Reply-To: <CABUevEzPW_OrC2nry0puBWhhz_e4+kx-Tv6=nsJGdJcGjzWUxQ@mail.gmail.com>
References: <15492-9b79ce7d1e0687a9@postgresql.org>
<CABUevEySKe_PvpVqqPaGhOmTkmaQtN+D4CsDoFGGFWfbVGgPng@mail.gmail.com>
<CAEepm=16ZLqpPk6LjPVORFrN0ix_zQ1VUM7Hs=iuP5ExGEE3sA@mail.gmail.com>
<CABUevEzPW_OrC2nry0puBWhhz_e4+kx-Tv6=nsJGdJcGjzWUxQ@mail.gmail.com>
09.11.2018 17:48, Magnus Hagander wrote:
> On Fri, Nov 9, 2018 at 2:25 AM Thomas Munro
> <thomas.munro@enterprisedb.com <mailto:thomas.munro@enterprisedb.com>>
> wrote:
>
> We saw a variant of this problem on appveyor (a Windows build-bot)
> when testing Daniel's patch to add an optional message (search for
> "timing"), and it was fixed as part of that patch, for the new code in
> that patch:
>
> https://www.postgresql.org/message-id/flat/C2C7C3EC-CC5F-44B6-9C78-637C88BD7D14@yesql.se
>
> Perhaps other pre-existing tests need similar treatment?
>
>
> Ah yes, that seems to be the same thing, and yes that seem like a
> reasonalbe solution. So something like:
> +select case
> + when pg_cancel_backend(pg_backend_pid())
> + then pg_sleep(60)
> +end;
>
> Alexander, can you check to see if making that change solves the issue
> on your machine?
Yes, after applying the attached patch, the issue is gone.
Best regards,
Alexander
Attachments:fix-pg_cancel_backend.patch (text/x-patch, 1.0K) downloaddiff --git a/src/test/regress/expected/hs_standby_functions.out b/src/test/regress/expected/hs_standby_functions.outindex e0af677ea1..7714d7bdd6 100644--- a/src/test/regress/expected/hs_standby_functions.out+++ b/src/test/regress/expected/hs_standby_functions.out@@ -36,5 +36,8 @@ from pg_locks where virtualxid = '1/1';
(1 row)
-- suicide is painless
-select pg_cancel_backend(pg_backend_pid());+select case+ when pg_cancel_backend(pg_backend_pid())+ then pg_sleep(60)+end;
ERROR: canceling statement due to user request
diff --git a/src/test/regress/sql/hs_standby_functions.sql b/src/test/regress/sql/hs_standby_functions.sqlindex 251bac0a43..23795a8668 100644--- a/src/test/regress/sql/hs_standby_functions.sql+++ b/src/test/regress/sql/hs_standby_functions.sql@@ -21,4 +21,7 @@ select locktype, virtualxid, virtualtransaction, mode, granted
from pg_locks where virtualxid = '1/1';
-- suicide is painless
-select pg_cancel_backend(pg_backend_pid());+select case+ when pg_cancel_backend(pg_backend_pid())+ then pg_sleep(60)+end;
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: exclusion@gmail.com, magnus@hagander.net, thomas.munro@enterprisedb.com
Subject: Re: BUG #15492: pg_cancel_backend(pg_backend_pid()) returns true sporadically
In-Reply-To: <a5b57f72-f0d4-38d0-9a26-a03eacf4f6ae@gmail.com>
References: <15492-9b79ce7d1e0687a9@postgresql.org> <CABUevEySKe_PvpVqqPaGhOmTkmaQtN+D4CsDoFGGFWfbVGgPng@mail.gmail.com> <CAEepm=16ZLqpPk6LjPVORFrN0ix_zQ1VUM7Hs=iuP5ExGEE3sA@mail.gmail.com> <CABUevEzPW_OrC2nry0puBWhhz_e4+kx-Tv6=nsJGdJcGjzWUxQ@mail.gmail.com> <a5b57f72-f0d4-38d0-9a26-a03eacf4f6ae@gmail.com>
* 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