diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 3063e0b..5d86deb 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -2843,8 +2843,17 @@ RecoveryConflictInterrupt(ProcSignalReason reason)
 void
 ProcessInterrupts(void)
 {
-	/* OK to accept interrupt now? */
-	if (InterruptHoldoffCount != 0 || CritSectionCount != 0)
+	/* 
+	 * OK to accept interrupt now?
+	 *
+	 * Normally this is very straightforward. We don't accept interrupts
+	 * between HOLD_INTERRUPTS() and RESUME_INTERRUPTS().
+	 *
+	 * For SyncRep, we want to accept SIGTERM signals while other interrupts
+	 * are held, so we have a special case solely when WaitingForSyncRep.
+	 */
+	if ((InterruptHoldoffCount != 0 || CritSectionCount != 0) &&
+		!(WaitingForSyncRep && ProcDiePending))
 		return;
 	InterruptPending = false;
 	if (ProcDiePending)
