pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Nathan Bossart <nathandbossart@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Sami Imseih <samimseih@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: Clean up NamedLWLockTranche stuff
Date: Fri, 27 Mar 2026 16:50:12 -0500
Message-ID: <acb7lL5zrsieS9k3@nathan> (raw )
In-Reply-To: <xsgt5dpoo27vezqf4a255v35sxsgtyxklwolganultoftmuzlo@vjpujzjhzmk2 >
References: <47aaf57e-1b7b-4e12-bda2-0316081ff50e@iki.fi >
<acVEqGemyK-Yjswa@nathan >
<adab98a3-a0e3-4455-9b63-ae6f1ecd18c9@iki.fi >
<CAA5RZ0ueB84OUews-mS0+ojeWaDtcoV1qY4CNZD8PrdGcaXW-g@mail.gmail.com >
<d78edccb-27c0-4c9c-baee-1ce7745c8cc4@iki.fi >
<0ba6cb8c-a893-4445-b8fa-fa9f52be8f39@iki.fi >
<CAA5RZ0s+-_d6RBSfmLvekGLTCi2EZ7hiHp3RhMVDEexGXq=7Vg@mail.gmail.com >
<CAA5RZ0sLENRM+BicUjQFs_rP38oPx3gm0SsGrD0-jMhhM+HZ_w@mail.gmail.com >
<1e1dd445-730e-40c9-b0f7-4d153bb013fb@iki.fi >
<xsgt5dpoo27vezqf4a255v35sxsgtyxklwolganultoftmuzlo@vjpujzjhzmk2 >
On Fri, Mar 27, 2026 at 05:22:33PM -0400, Andres Freund wrote:
> TRAP: failed Assert("MemoryContextIsValid(context)"), File: "mcxt.c", Line: 1270, PID: 230491
> [...](ExceptionalCondition+0x54)[0xaaaae186c204]
> [...](MemoryContextAllocExtended+0x0)[0xaaaae18a2a24]
> [...](RequestNamedLWLockTranche+0x6c)[0xaaaae16e7310]
> [...](process_shmem_requests+0x28)[0xaaaae1881628]
> [...](PostgresSingleUserMain+0xc4)[0xaaaae1701a34]
> [...](main+0x6ac)[0xaaaae12a2adc]
> /lib/aarch64-linux-gnu/libc.so.6(__libc_start_main+0xe8)[0xffff99713dd8]
> [...](+0xf2b98)[0xaaaae12a2b98]
> Aborted
> pg_rewind: error: postgres single-user mode in target cluster failed
Hm. AFAICT PostmasterContext isn't created in single-user mode, and the
commit in question has RequestNamedLWLockTranche() allocate requests there.
I guess the idea is to allow backends to free that memory after forking
from postmaster, but we don't do that for the NamedLWLockTrancheRequests
list. Maybe we should surround the last part of that function with
MemoryContextSwitchTo(...) to either TopMemoryContext or PostmasterContext
depending on whether we're in single-user mode.
--
nathan
view thread (18+ messages) latest in thread
Message-ID: <acb7lL5zrsieS9k3@nathan>
Permalink: ../acb7lL5zrsieS9k3@nathan/
Also on: postgresql.org/message-id/acb7lL5zrsieS9k3@nathan
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: nathandbossart@gmail.com, andres@anarazel.de, hlinnaka@iki.fi, samimseih@gmail.com, robertmhaas@gmail.com
Subject: Re: Clean up NamedLWLockTranche stuff
In-Reply-To: <acb7lL5zrsieS9k3@nathan>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox