Don't let timeout interrupts happen unless ImmediateInterruptOK is set.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 478af9b79770da43a2d89fcc5872d09a2d8731f8
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2013-12-13T16:50:25Z
Releases: 9.3.3
Don't let timeout interrupts happen unless ImmediateInterruptOK is set.

Serious oversight in commit 16e1b7a1b7f7ffd8a18713e83c8cd72c9ce48e07:
we should not allow an interrupt to take control away from mainline code
except when ImmediateInterruptOK is set.  Just to be safe, let's adopt
the same save-clear-restore dance that's been used for many years in
HandleCatchupInterrupt and HandleNotifyInterrupt, so that nothing bad
happens if a timeout handler invokes code that tests or even manipulates
ImmediateInterruptOK.

Per report of "stuck spinlock" failures from Christophe Pettus, though
many other symptoms are possible.  Diagnosis by Andres Freund.

Files

PathChange+/−
src/backend/utils/misc/timeout.c modified +23 −13