diff options
author | Noah Misch | 2013-09-12 00:10:15 +0000 |
---|---|---|
committer | Noah Misch | 2013-09-12 00:14:29 +0000 |
commit | f0d76a515e88a2709e23693c2f9cfb979063dfe2 (patch) | |
tree | 06237843511ee3c96a4090a5ac54d8d909e524c0 | |
parent | 994362a317ced987b6ea616b236c402d715ddcd5 (diff) |
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.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index ad33ae079bd..c7f36486ff7 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -2571,6 +2571,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 |