]> granicus.if.org Git - postgresql/commit
Add HOLD/RESUME_INTERRUPTS in HandleCatchupInterrupt/HandleNotifyInterrupt.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 13 Dec 2013 19:05:16 +0000 (14:05 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 13 Dec 2013 19:05:16 +0000 (14:05 -0500)
commit0cfc67bf4f39770e89c0b99f0bb99effdfc80b60
treecabb7399f9b46ab239a0906c743866a8e7c36951
parent478af9b79770da43a2d89fcc5872d09a2d8731f8
Add HOLD/RESUME_INTERRUPTS in HandleCatchupInterrupt/HandleNotifyInterrupt.

This prevents a possible longjmp out of the signal handler if a timeout
or SIGINT occurs while something within the handler has transiently set
ImmediateInterruptOK.  For safety we must hold off the timeout or cancel
error until we're back in mainline, or at least till we reach the end of
the signal handler when ImmediateInterruptOK was true at entry.  This
syncs these functions with the logic now present in handle_sig_alarm.

AFAICT there is no live bug here in 9.0 and up, because I don't think we
currently can wait for any heavyweight lock inside these functions, and
there is no other code (except read-from-client) that will turn on
ImmediateInterruptOK.  However, that was not true pre-9.0: in older
branches ProcessIncomingNotify might block trying to lock pg_listener, and
then a SIGINT could lead to undesirable control flow.  It might be all
right anyway given the relatively narrow code ranges in which NOTIFY
interrupts are enabled, but for safety's sake I'm back-patching this.
src/backend/commands/async.c
src/backend/storage/ipc/sinval.c