Re: Segmentation fault on proc exit after dshash_find_or_insert

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Rahila Syed <rahilasyed90(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Segmentation fault on proc exit after dshash_find_or_insert
Date: 2026-01-14 23:57:36
Message-ID: CA+HiwqGzfwyYc3+tDqucYyMOS_Z6eGpYmAwfB284v1dMf+tN7A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 15, 2026 at 12:38 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Amit Langote <amitlangote09(at)gmail(dot)com> writes:
> > On Wed, Jan 14, 2026 at 6:36 PM Álvaro Herrera <alvherre(at)kurilemu(dot)de> 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(). But, probably best to leave
ProcKill() alone given this subtlety.

--
Thanks, Amit Langote

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-01-15 00:00:31 Re: Refactor replication origin state reset helpers
Previous Message Andres Freund 2026-01-14 23:37:54 Re: Buffer locking is special (hints, checksums, AIO writes)