pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathandbossart@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Nathan Bossart <nathan@postgresql.org>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Move named LWLock tranche requests to shared memory.
Date: Tue, 16 Sep 2025 22:27:34 -0500
Message-ID: <aMoqphZNkFJ_iy_K@nathan> (raw)
In-Reply-To: <aMoejB3iTWy1SxfF@paquier.xyz>
References: <E1uwodL-000EuJ-2j@gemulon.postgresql.org>
	<aMoejB3iTWy1SxfF@paquier.xyz>

On Wed, Sep 17, 2025 at 11:35:56AM +0900, Michael Paquier wrote:
> Since this commit has been merged, batta has kept failing.  Here is
> the first failure:
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=batta&dt=2025-09-12%2002%3A05%3A01

Thanks for bringing this to my attention.

> And here is the backtrace:
> #0  0x000055fcdf6bc97a in NumLWLocksForNamedTranches () at lwlock.c:385
> 385 numLocks += NamedLWLockTrancheRequestArray[i].num_lwlocks;
> (gdb) bt
> #0  0x000055fcdf6bc97a in NumLWLocksForNamedTranches () at lwlock.c:385 
> #1  0x000055fcdf6bc9b3 in LWLockShmemSize () at lwlock.c:400 
> #2  0x000055fcdf65bda5 in CalculateShmemSize (num_semaphores=0x7ffcaf7a78e4) at ipci.c:130 
> #3  0x000055fcdf65c0b1 in CreateSharedMemoryAndSemaphores () at ipci.c:210 
> #4  0x000055fcdf42830c in PostmasterStateMachine () at postmaster.c:3223 
> #5  0x000055fcdf42703f in process_pm_child_exit () at postmaster.c:2558 
> #6  0x000055fcdf425729 in ServerLoop () at postmaster.c:1696 
> #7  0x000055fcdf424be1 in PostmasterMain (argc=4, argv=0x55fd0a8faa10) at postmaster.c:1403 
> #8  0x000055fcdef80a19 in main (argc=4, argv=0x55fd0a8faa10) at main.c:231
> (gdb) p i
> $3 = 0
> (gdb) p NamedLWLockTrancheRequestArray[0]
> Cannot access memory at address 0x7f15ee4ccc08

It looks like the postmaster is trying to access the request array after
re-initializing shared memory, which of course fails.  So, we need to keep
the request array in postmaster's local memory, too.  Attached is a quick
attempt at a fix.

-- 
nathan

Attachments:

  v1-0001-fix-LWLock-shmem-reinitialization.patch (text/plain, 0B) download

view thread (9+ messages)  latest in thread

Message-ID: <aMoqphZNkFJ_iy_K@nathan>
Permalink:  ../aMoqphZNkFJ_iy_K@nathan/
Also on:    postgresql.org/message-id/aMoqphZNkFJ_iy_K@nathan

 ·  · 

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-committers@postgresql.org
  Cc: nathandbossart@gmail.com, michael@paquier.xyz, nathan@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Move named LWLock tranche requests to shared memory.
  In-Reply-To: <aMoqphZNkFJ_iy_K@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