pgsql: Accept SIGQUIT during error recovery in auxiliary processes. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Accept SIGQUIT during error recovery in auxiliary processes.
Date
Msg-id E1kGpEw-0005HR-5M@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: Alvaro Herrera
Date:
Subject: pgsql: psql: Display stats target of extended statistics
Next
From: Jeff Davis
Date:
Subject: pgsql: logtape.c: do not preallocate for tapes when sorting