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: Accept SIGQUIT during error recovery in auxiliary processes.
Date: Fri, 11 Sep 2020 20:01:46 +0000
Message-ID: <E1kGpEw-0005HR-5M@gemulon.postgresql.org> (raw)

Accept SIGQUIT during error recovery in auxiliary processes.

The bgwriter, checkpointer, walwriter, and walreceiver processes
claimed to allow SIGQUIT "at all times".  In reality SIGQUIT
would get re-blocked during error recovery, because we didn't
update the actual signal mask immediately, so sigsetjmp() would
save and reinstate a mask that includes SIGQUIT.

This appears to be simply a coding oversight.  There's never a
good reason to hold off SIGQUIT in these processes, because it's
going to just call _exit(2) which should be safe enough, especially
since the postmaster is going to tear down shared memory afterwards.
Hence, stick in PG_SETMASK() calls to install the modified BlockSig
mask immediately.

Also try to improve the comments around sigsetjmp blocks.  Most of
them were just referencing postgres.c, which is misleading because
actually postgres.c manages the signals differently.

No back-patch, since there's no evidence that this is causing any
problems in the field.

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7634bd4f6d38bdef1fe442df5c2e0da73f1f90f4

Modified Files
--------------
src/backend/postmaster/autovacuum.c   | 16 +++++++++++++++-
src/backend/postmaster/bgwriter.c     | 18 ++++++++++++++++--
src/backend/postmaster/checkpointer.c | 18 ++++++++++++++++--
src/backend/postmaster/walwriter.c    | 18 ++++++++++++++++--
src/backend/replication/walreceiver.c |  3 ++-
5 files changed, 65 insertions(+), 8 deletions(-)



Message-ID: <E1kGpEw-0005HR-5M@gemulon.postgresql.org>
Permalink:  ../E1kGpEw-0005HR-5M@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1kGpEw-0005HR-5M@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: Accept SIGQUIT during error recovery in auxiliary processes.
  In-Reply-To: <E1kGpEw-0005HR-5M@gemulon.postgresql.org>
  References: <E1kGpEw-0005HR-5M@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