]> granicus.if.org Git - postgresql/commitdiff
Ignore WL_POSTMASTER_DEATH latch event in single user mode
authorPeter Eisentraut <peter_e@gmx.net>
Sat, 3 Jun 2017 03:02:13 +0000 (23:02 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Tue, 6 Jun 2017 01:03:35 +0000 (21:03 -0400)
Otherwise code that uses this will abort with an assertion failure,
because postmaster_alive_fds are not initialized.

Reported-by: tushar <tushar.ahuja@enterprisedb.com>
src/backend/storage/ipc/latch.c

index 53e6bf2477ddbba5c3e711dc5810c45119af029e..55959de91f3bf36527bb4898ad65a4422efc9421 100644 (file)
@@ -370,7 +370,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
                AddWaitEventToSet(set, WL_LATCH_SET, PGINVALID_SOCKET,
                                                  (Latch *) latch, NULL);
 
-       if (wakeEvents & WL_POSTMASTER_DEATH)
+       if (wakeEvents & WL_POSTMASTER_DEATH && IsUnderPostmaster)
                AddWaitEventToSet(set, WL_POSTMASTER_DEATH, PGINVALID_SOCKET,
                                                  NULL, NULL);