From 757c67c1d4895ce6a523bcf5217af8eb2351e2a1 Mon Sep 17 00:00:00 2001 From: "yizhi.fzh" Date: Mon, 22 Jan 2024 07:14:29 +0800 Subject: [PATCH v7 3/3] Bypass SpinLock checking in SIGQUIT signal hander When a process receives a SIGQUIT signal, it indicates the system has a crash time. It's possible that the process is just holding a Spin lock. By our current checking, this process will PANIC with a misuse of spinlock which is pretty prone to misunderstanding. so we need to bypass the spin lock holding checking in this case. It is safe since the overall system will be restarted. --- src/backend/storage/lmgr/spin.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/backend/storage/lmgr/spin.c b/src/backend/storage/lmgr/spin.c index 08cc6da5d9..be9b091d3f 100644 --- a/src/backend/storage/lmgr/spin.c +++ b/src/backend/storage/lmgr/spin.c @@ -22,6 +22,7 @@ */ #include "postgres.h" +#include "libpq/pqsignal.h" #include "storage/pg_sema.h" #include "storage/shmem.h" #include "storage/spin.h" @@ -186,6 +187,11 @@ void VerifyNoSpinLocksHeld(void) { #ifdef USE_ASSERT_CHECKING + /* + * In the quickdie progress, it's OK to ignore the spin lock checking. + */ + if (sigismember(&BlockSig, SIGQUIT)) + return; if (last_spin_lock_file != NULL) elog(PANIC, "A spin lock has been held at %s:%d", last_spin_lock_file, last_spin_lock_lineno); -- 2.34.1