aboutsummaryrefslogtreecommitdiff
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:14:07 -0400
commit374652fb6dc53a12f79586ce0e77f1ec22d58a80 (patch)
treec19910c58d2b1db5f09d3b6bee0c0b4f15425b6b
parent1eea0ebddcea776ec771f9a3a62feb83a68b54ea (diff)
downloadpostgresql-374652fb6dc53a12f79586ce0e77f1ec22d58a80.tar.gz
postgresql-374652fb6dc53a12f79586ce0e77f1ec22d58a80.zip
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 ba895d5854a..beb2cc2d7e4 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -2525,6 +2525,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();
+
+ /*
* If we're aborting out of client auth, don't risk trying to send
* anything to the client; we will likely violate the protocol, not to
* mention that we may have interrupted the guts of OpenSSL or some