postgres.git / summary / log / commit / refs

commit    9553d0f03b17d96af304f767c596dace953c736e
Author:   Noah Misch <noah@leadboat.com>
Date:     Thu Sep 12 00:10:15 2013 +0000
First released in: 9.4.0, 8.4.18, 9.0.14, 9.1.10, 9.2.5, 9.3.1

    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.


src/backend/tcop/postgres.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 363b60891e0..3e63df70576 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -2610,6 +2610,13 @@ quickdie(SIGNAL_ARGS) sigaddset(&BlockSig, SIGQUIT); /* prevent nested calls */ 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 [parent: 994f68d15b8c]