Skip to content

Commit f690acf

Browse files
committed
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.
1 parent bb402a0 commit f690acf

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/backend/commands/async.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.91 2002/09/16 01:24:41 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.92 2003/02/18 02:53:29 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -599,6 +599,16 @@ Async_NotifyHandler(SIGNAL_ARGS)
599599

600600
if (notifyInterruptEnabled)
601601
{
602+
bool save_ImmediateInterruptOK = ImmediateInterruptOK;
603+
604+
/*
605+
* We may be called while ImmediateInterruptOK is true; turn it off
606+
* while messing with the NOTIFY state. (We would have to save
607+
* and restore it anyway, because PGSemaphore operations inside
608+
* ProcessIncomingNotify() might reset it.)
609+
*/
610+
ImmediateInterruptOK = false;
611+
602612
/*
603613
* I'm not sure whether some flavors of Unix might allow another
604614
* SIGUSR2 occurrence to recursively interrupt this routine. To
@@ -626,6 +636,13 @@ Async_NotifyHandler(SIGNAL_ARGS)
626636
elog(LOG, "Async_NotifyHandler: done");
627637
}
628638
}
639+
640+
/*
641+
* Restore ImmediateInterruptOK, and check for interrupts if needed.
642+
*/
643+
ImmediateInterruptOK = save_ImmediateInterruptOK;
644+
if (save_ImmediateInterruptOK)
645+
CHECK_FOR_INTERRUPTS();
629646
}
630647
else
631648
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy