public inbox for [email protected]  
help / color / mirror / Atom feed
From: Amit Langote <[email protected]>
To: Tom Lane <[email protected]>
Cc: Álvaro Herrera <[email protected]>
Cc: Rahila Syed <[email protected]>
Cc: Andres Freund <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Subject: Re: Segmentation fault on proc exit after dshash_find_or_insert
Date: Thu, 15 Jan 2026 09:12:35 +0900
Message-ID: <CA+HiwqHk2qOrCdhU=nqJsU8uMVWkusmyCT3OrWzTYSaFPCw-nQ@mail.gmail.com> (raw)
In-Reply-To: <CA+HiwqGzfwyYc3+tDqucYyMOS_Z6eGpYmAwfB284v1dMf+tN7A@mail.gmail.com>
References: <CA+HiwqHzTpLH9q3XHSiXndCgVYi8CvaeOcMgu7ZoYS2XOYqtiA@mail.gmail.com>
	<[email protected]>
	<CA+HiwqG7uO2+c0AV8CWt7qG1izzN3PjdKDtgMqK9a0tiNvzHnw@mail.gmail.com>
	<[email protected]>
	<CA+HiwqGzfwyYc3+tDqucYyMOS_Z6eGpYmAwfB284v1dMf+tN7A@mail.gmail.com>

On Thu, Jan 15, 2026 at 8:57 Amit Langote <[email protected]> wrote:

> On Thu, Jan 15, 2026 at 12:38 AM Tom Lane <[email protected]> wrote:
> > Amit Langote <[email protected]> writes:
> > > On Wed, Jan 14, 2026 at 6:36 PM Álvaro Herrera <[email protected]>
> wrote
> > >> Looking at ProcKill, I notice that we do some LWLock ops after its
> > >> LWLockReleaseAll() call, which seems a bit silly.  Why not do that
> right
> > >> after the "if (MyProc->lockGroupLeader != NULL)" block instead?
> Nothing
> > >> uses LWLocks from there on.  This can be a separate commit.
> >
> > > Just to confirm: you're suggesting moving the LWLockReleaseAll() call
> > > to after the "if (MyProc->lockGroupLeader != NULL)" block? Makes sense
> > > -- odd to release all locks right before then going ahead and
> > > acquiring one. Agreed it should be a separate commit.
> >
> > I think the idea there might be to make sure that we have released
> > any pre-existing hold of that lock.  Otherwise this could be
> > a self-deadlock.
>
> Hmm, good point. Though with this patch, which adds LWLockReleaseAll()
> at the start of shmem_exit(), we would have already released any such
> lock before we get to ProcKill().


Scratch that. shmem_exit() is hardly the only caller of ProcKill() and
while the existing callers seem to be disciplined, any future callers may
not always release locks beforehand.

>


view thread (2+ messages)

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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Segmentation fault on proc exit after dshash_find_or_insert
  In-Reply-To: <CA+HiwqHk2qOrCdhU=nqJsU8uMVWkusmyCT3OrWzTYSaFPCw-nQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox