Skip to content

Commit f0d76a5

Browse files
committed
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.
1 parent 994362a commit f0d76a5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/backend/tcop/postgres.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2570,6 +2570,13 @@ quickdie(SIGNAL_ARGS)
25702570
sigaddset(&BlockSig, SIGQUIT); /* prevent nested calls */
25712571
PG_SETMASK(&BlockSig);
25722572

2573+
/*
2574+
* Prevent interrupts while exiting; though we just blocked signals that
2575+
* would queue new interrupts, one may have been pending. We don't want a
2576+
* quickdie() downgraded to a mere query cancel.
2577+
*/
2578+
HOLD_INTERRUPTS();
2579+
25732580
/*
25742581
* If we're aborting out of client auth, don't risk trying to send
25752582
* anything to the client; we will likely violate the protocol, not to

0 commit comments

Comments
 (0)