Re: Prevent an error on attaching/creating a DSM/DSA from an interrupt handler.

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Rahila Syed <rahilasyed90(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, Tomas Vondra <tomas(at)vondra(dot)me>
Subject: Re: Prevent an error on attaching/creating a DSM/DSA from an interrupt handler.
Date: 2025-04-30 21:24:36
Message-ID: 8B873D49-E0E5-4F9F-B8D6-CA4836B825CD@yesql.se
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 11 Apr 2025, at 21:08, Rahila Syed <rahilasyed90(at)gmail(dot)com> wrote:
>
> Hi Daniel,
>
> Thank you for your review and code improvements.
>
> Please find below some observations.
>
> 1. dsm_unpin_mapping(dsm_segment *seg)
> + if (CurrentResourceOwner && IsResourceOwnerReleasing(CurrentResourceOwner))
> + return;
>
> Given that the function can return without setting resowner to a
> CurrentResourceOwner which is not NULL, shall we change the function
> signature to return true when "unpin" is successful and false when not?

Maybe, but at this point in the cycle we cannot change the prototype like that.
Food for thought for v19 though.

> 2. If value of IsResourceOwnerReleasing changes between dsm_create_descriptor
> and attach_internal, the dsm segment and dsa area will end up with different resource owners.
> Earlier the chances of CurrentResourceOwner changing between the two functions were zero.
> May be something can be done to keep resowner assignments under both these functions
> in sync.

Hmm, that's a good question, not sure. Do you have a repro for this handy?

Attached is a current v4 with a few small tweaks.

--
Daniel Gustafsson

Attachment Content-Type Size
v4-0001-Don-t-try-to-enlarge-resourceowner-when-releasing.patch application/octet-stream 8.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sami Imseih 2025-04-30 21:52:06 queryId constant squashing does not support prepared statements
Previous Message David G. Johnston 2025-04-30 21:15:51 Re: fixing CREATEROLE