Don't unblock SIGQUIT in the SIGQUIT handler
authorPeter Eisentraut <[email protected]>
Wed, 16 Dec 2009 23:05:00 +0000 (23:05 +0000)
committerPeter Eisentraut <[email protected]>
Wed, 16 Dec 2009 23:05:00 +0000 (23:05 +0000)
This was possibly linked to a deadlock-like situation in glibc syslog code
invoked by the ereport call in quickdie().  In any case, a signal handler
should not unblock its own signal unless there is a specific reason to.

src/backend/tcop/postgres.c
src/include/libpq/pqsignal.h

index c7906bfa1bb5fc2e137415b4820dfdd498632a63..b2fb501882ff743d342c78f45cfb558a70010210 100644 (file)
@@ -2538,6 +2538,7 @@ drop_unnamed_stmt(void)
 void
 quickdie(SIGNAL_ARGS)
 {
+   sigaddset(&BlockSig, SIGQUIT); /* prevent nested calls */
    PG_SETMASK(&BlockSig);
 
    /*
index 82414d62d7a2275213f0dee740b1c22a7b9b9236..4659ae21d1ca1b636849cfafadd21547f3deb4e2 100644 (file)
@@ -38,6 +38,7 @@ extern int    UnBlockSig,
 int            pqsigsetmask(int mask);
 #endif
 
+#define sigaddset(set, signum) (*(set) |= (sigmask(signum)))
 #define sigdelset(set, signum) (*(set) &= ~(sigmask(signum)))
 #endif /* not HAVE_SIGPROCMASK */