mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-02 14:01:18 +02:00
Async_NotifyHandler must save and restore ImmediateInterruptOK. Fixes
known problem with failure to respond to 'pg_ctl stop -m fast', and probable problems if SIGINT or SIGTERM arrives while processing a SIGUSR2 interrupt that arrived while waiting for a new client query.
This commit is contained in:
parent
bb402a0eca
commit
f690acf104
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.91 2002/09/16 01:24:41 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.92 2003/02/18 02:53:29 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -599,6 +599,16 @@ Async_NotifyHandler(SIGNAL_ARGS)
|
|||||||
|
|
||||||
if (notifyInterruptEnabled)
|
if (notifyInterruptEnabled)
|
||||||
{
|
{
|
||||||
|
bool save_ImmediateInterruptOK = ImmediateInterruptOK;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We may be called while ImmediateInterruptOK is true; turn it off
|
||||||
|
* while messing with the NOTIFY state. (We would have to save
|
||||||
|
* and restore it anyway, because PGSemaphore operations inside
|
||||||
|
* ProcessIncomingNotify() might reset it.)
|
||||||
|
*/
|
||||||
|
ImmediateInterruptOK = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* I'm not sure whether some flavors of Unix might allow another
|
* I'm not sure whether some flavors of Unix might allow another
|
||||||
* SIGUSR2 occurrence to recursively interrupt this routine. To
|
* SIGUSR2 occurrence to recursively interrupt this routine. To
|
||||||
@ -626,6 +636,13 @@ Async_NotifyHandler(SIGNAL_ARGS)
|
|||||||
elog(LOG, "Async_NotifyHandler: done");
|
elog(LOG, "Async_NotifyHandler: done");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Restore ImmediateInterruptOK, and check for interrupts if needed.
|
||||||
|
*/
|
||||||
|
ImmediateInterruptOK = save_ImmediateInterruptOK;
|
||||||
|
if (save_ImmediateInterruptOK)
|
||||||
|
CHECK_FOR_INTERRUPTS();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user