summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2013-09-11 20:10:15 -0400
committerNoah Misch <noah@leadboat.com>2013-09-11 20:17:52 -0400
commit312116ed7da6cffb51a4c60a619242b0707cb5dc (patch)
tree0dc675130f7eb8b7b6c2ca4848a5575f31f8800a
parent83ec831368746163994a1ad7a705749af589f5d9 (diff)
downloadpostgresql-312116ed7da6cffb51a4c60a619242b0707cb5dc.tar.gz
Ignore interrupts during quickdie().
Once the administrator has called for an immediate shutdown or a backend crash has triggered a reinitialization, no mere SIGINT or SIGTERM should change that course. Such derailment remains possible when the signal arrives before quickdie() blocks signals. That being a narrow race affecting most PostgreSQL signal handlers in some way, leave it for another patch. Back-patch this to all supported versions.
-rw-r--r--src/backend/tcop/postgres.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index b22ea3deb6..382112c727 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -2489,6 +2489,13 @@ quickdie(SIGNAL_ARGS)
PG_SETMASK(&BlockSig);
/*
+ * Prevent interrupts while exiting; though we just blocked signals that
+ * would queue new interrupts, one may have been pending. We don't want a
+ * quickdie() downgraded to a mere query cancel.
+ */
+ HOLD_INTERRUPTS();
+
+ /*
* Ideally this should be ereport(FATAL), but then we'd not get control
* back...
*/