Skip to content

Commit f7dfccf

Browse files
michaelpqrdunklau
andcommitted
Fix assertion failure with latch wait in single-user mode
LatchWaitSetPostmasterDeathPos, the latch event position for the postmaster death event, is initialized under IsUnderPostmaster. WaitLatch() considered it as a valid wait target in single-user mode (!IsUnderPostmaster), which was incorrect. One code path found to fail with an assertion failure is a database drop in single-user mode while waiting in WaitForProcSignalBarrier() after the drop. Oversight in commit 84e5b2f. Author: Patrick Stählin <me@packi.ch> Co-authored-by: Ronan Dunklau <ronan.dunklau@aiven.io> Discussion: https://postgr.es/m/18996-3a2744c8140488de@postgresql.org Backpatch-through: 18
1 parent 2973b1c commit f7dfccf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/backend/storage/ipc/latch.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,11 @@ WaitLatch(Latch *latch, int wakeEvents, long timeout,
187187
if (!(wakeEvents & WL_LATCH_SET))
188188
latch = NULL;
189189
ModifyWaitEvent(LatchWaitSet, LatchWaitSetLatchPos, WL_LATCH_SET, latch);
190-
ModifyWaitEvent(LatchWaitSet, LatchWaitSetPostmasterDeathPos,
191-
(wakeEvents & (WL_EXIT_ON_PM_DEATH | WL_POSTMASTER_DEATH)),
192-
NULL);
190+
191+
if (IsUnderPostmaster)
192+
ModifyWaitEvent(LatchWaitSet, LatchWaitSetPostmasterDeathPos,
193+
(wakeEvents & (WL_EXIT_ON_PM_DEATH | WL_POSTMASTER_DEATH)),
194+
NULL);
193195

194196
if (WaitEventSetWait(LatchWaitSet,
195197
(wakeEvents & WL_TIMEOUT) ? timeout : -1,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy