pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid lockup of a parallel worker when reporting a long error me
Date: Thu, 03 Sep 2020 20:52:32 +0000
Message-ID: <E1kDwDg-0002CD-GB@gemulon.postgresql.org> (raw)

Avoid lockup of a parallel worker when reporting a long error message.

Because sigsetjmp() will restore the initial state with signals blocked,
the code path in bgworker.c for reporting an error and exiting would
execute that way.  Usually this is fairly harmless; but if a parallel
worker had an error message exceeding the shared-memory communication
buffer size (16K) it would lock up, because it would wait for a
resume-sending signal from its parallel leader which it would never
detect.

To fix, just unblock signals at the appropriate point.

This can be shown to fail back to 9.6.  The lack of parallel query
infrastructure makes it difficult to provide a simple test case for
9.5; but I'm pretty sure the issue exists in some form there as well,
so apply the code change there too.

Vignesh C, reviewed by Bharath Rupireddy, Robert Haas, and myself

Discussion: https://postgr.es/m/CALDaNm1d1hHPZUg3xU4XjtWBOLCrA+-2cJcLpw-cePZ=GgDVfA@mail.gmail.com

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2500e51e7bdc6c4f01312db276d3460644684112

Modified Files
--------------
src/backend/postmaster/bgworker.c             | 11 +++++++++--
src/test/regress/expected/select_parallel.out |  7 ++++---
src/test/regress/sql/select_parallel.sql      |  3 ++-
3 files changed, 15 insertions(+), 6 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1kDwDg-0002CD-GB@gemulon.postgresql.org>
Permalink:  ../E1kDwDg-0002CD-GB@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1kDwDg-0002CD-GB@gemulon.postgresql.org

 · 

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 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-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Avoid lockup of a parallel worker when reporting a long error me
  In-Reply-To: <E1kDwDg-0002CD-GB@gemulon.postgresql.org>
  References: <E1kDwDg-0002CD-GB@gemulon.postgresql.org>

* 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