| From: | Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> |
|---|---|
| To: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
| Cc: | Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: [PATCH] Two remaining shmem attachment issues in single-user mode |
| Date: | 2026-10-01 10:34:36 |
| Message-ID: | CAExHW5vAQTz5WFii02nKhTML5R5c9j=6YD47bKeXMo7rA5THWw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, Sep 30, 2026 at 5:13 PM Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:
>
> On 25/09/2026 10:07, Ashutosh Bapat wrote:
> > Replacing the IsUnderPostmaster check with a check for whether shared
> > memory has been initialized seems appropriate. However, ShmemIndex
> > remains non-NULL when the postmaster restarts after a backend crash
> > and recreates shared memory. The registered callbacks are retained,
> > but the pending requests are rebuilt by calling those callbacks again.
> > If the callbacks return the same sizes as before, we will not
> > encounter an unknown size. Still, the check seems brittle: it would
> > not reject an unknown size supplied by a callback during restart, and
> > the request would instead fail later in the size calculation.
>
> A-ha, good catch.
>
> > We need to reject SHMEM_ATTACH_UNKNOWN_SIZE before allocating the
> > shared-memory segment because its size must be known. Could we perform
> > this check in ShmemGetRequestedSize()? That seems like a more specific
> > place for it than ShmemRequestInternal(), which handles requests both
> > at startup and afterward.
>
> Hmm, I guess that'd work too. It feels a little weird to not get the
> error immediately in the ShmemRequestStruct() call though.
With ShmemIndex == NULL fix, the check is at a place from where it
matters and two places are connected via a callback which is not
apparent. I have a feeling that we might see some more reports in this
area. But let's wait for that.
>
> Ok, I picked a mix of these test changes that I liked the best, and
> committed :-). Thank you both!
Thanks.
--
Best Wishes,
Ashutosh Bapat
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Zhijie Hou | 2026-10-01 10:45:54 | Re: Fix apply worker crash when subscriber table has only a deferrable primary key |
| Previous Message | Ilia Evdokimov | 2026-10-01 10:24:30 | Re: Fold NOT IN / <> ALL expressions containing NULL to FALSE |