pgsql: Fix assertion failure with latch wait in single-user mode

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix assertion failure with latch wait in single-user mode
Date: 2025-07-25 07:17:58
Message-ID: E1ufCgo-000dR5-0m@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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 84e5b2f07a5e.

Author: Patrick Stählin <me(at)packi(dot)ch>
Co-authored-by: Ronan Dunklau <ronan(dot)dunklau(at)aiven(dot)io>
Discussion: https://postgr.es/m/18996-3a2744c8140488de@postgresql.org
Backpatch-through: 18

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/f7dfccf9605dab54956321e236de3415a2ba2fa3

Modified Files
--------------
src/backend/storage/ipc/latch.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2025-07-25 09:41:08 pgsql: Fix background worker not restarting after crash-and-restart cyc
Previous Message Michael Paquier 2025-07-25 02:18:20 pgsql: Lower bounds related to pgstats kinds