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

2025-05-23 Thread Daniel Gustafsson
> On 20 May 2025, at 11:56, Daniel Gustafsson wrote: > >> On 20 May 2025, at 04:29, Tom Lane wrote: > >> I want to argue for reverting, at least for v18. I do not think that >> ProcessGetMemoryContextInterrupt is anywhere near release-quality. >> I found out while poking into Valgrind leak rep

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

2025-05-20 Thread Daniel Gustafsson
> On 20 May 2025, at 04:29, Tom Lane wrote: > I want to argue for reverting, at least for v18. I do not think that > ProcessGetMemoryContextInterrupt is anywhere near release-quality. > I found out while poking into Valgrind leak reports that it leaks > memory --- and does so in TopMemoryContext

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

2025-05-19 Thread Tom Lane
Robert Haas writes: > What I'm concerned about is that I think that (as I said on the other > thread) is that ProcessGetMemoryContextInterrupt is not really at all > safe to execute at an arbitrary CHECK_FOR_INTERRUPTS(). I agree. > In my mind, the possible fixes here are (1) revert that patch,

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

2025-05-19 Thread Daniel Gustafsson
> On 1 May 2025, at 14:40, Robert Haas wrote: > ..in general I'm > skeptical that we can really set up something that is OK to do in an > aborted transaction, because our ability to handle any further errors > at that point is extremely limited, and this code is definitely > complex enough that i

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

2025-05-04 Thread Mihail Nikalayeu
Hello, everyone. Not sure if it helps but encountered the same problem in relation to injection points: https://www.postgresql.org/message-id/flat/CANtu0oiTgFW47QgpTwrMOVm3Bq4N0Y5bjvTy5sP0gYWLQuVgjw%40mail.gmail.com

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

2025-05-01 Thread Robert Haas
On Wed, Apr 30, 2025 at 6:56 PM Michael Paquier wrote: > I'm actually rather scared of the patch, isn't there a risk of > breaking existing patterns that worked out of the box by forcing the > resowner to not be set? My spidey sense tingles when I see such > patterns, because this is enforcing as

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

2025-05-01 Thread Rahila Syed
Hi, On Thu, May 1, 2025 at 4:26 AM Michael Paquier wrote: > On Wed, Apr 30, 2025 at 06:03:49PM -0400, Robert Haas wrote: > > Sorry to turn up late here, but I strongly disagree with the notion > > that this is a bug in the DSM or DSA code. It seems to me that it is > > the caller's responsibilit

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

2025-05-01 Thread Daniel Gustafsson
> On 1 May 2025, at 00:04, Robert Haas wrote: > > On Wed, Apr 30, 2025 at 5:24 PM Daniel Gustafsson wrote: >> Attached is a current v4 with a few small tweaks. > > Sorry to turn up late here, but I strongly disagree with the notion > that this is a bug in the DSM or DSA code. It seems to me th

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

2025-04-30 Thread Michael Paquier
On Wed, Apr 30, 2025 at 06:03:49PM -0400, Robert Haas wrote: > Sorry to turn up late here, but I strongly disagree with the notion > that this is a bug in the DSM or DSA code. It seems to me that it is > the caller's responsibility to provide a valid resource owner, not the > job of the called code

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

2025-04-30 Thread Robert Haas
On Wed, Apr 30, 2025 at 5:24 PM Daniel Gustafsson wrote: > Attached is a current v4 with a few small tweaks. Sorry to turn up late here, but I strongly disagree with the notion that this is a bug in the DSM or DSA code. It seems to me that it is the caller's responsibility to provide a valid reso

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

2025-04-30 Thread Daniel Gustafsson
> On 11 Apr 2025, at 21:08, Rahila Syed 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)) > +

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

2025-04-11 Thread Rahila Syed
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

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

2025-04-11 Thread Daniel Gustafsson
> On 24 Mar 2025, at 20:31, Rahila Syed wrote: > Please find the attached updated and rebased patch. Thanks for this rebase, as was mentioned in the other thread I plan to get this committed fairly soon. A few comments on the code, all performed in the attached v3. + else + { +

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

2025-03-24 Thread Rahila Syed
Hi, Please find the attached updated and rebased patch. I have added a test in the test_dsa module that uses a function to create a dsa area. This function is called after the resowner->releasing is set to true, using an injection point. Thank you, Rahila Syed v2-0001-Prevent-the-error-on-creat

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

2025-01-13 Thread Rahila Syed
Hi, If a DSM is created or attached from an interrupt handler while a transaction is being rolled back, it may result in the following error. "ResourceOwnerEnlarge called after release started" This was found during the testing of Enhancing Memory Context Reporting feature by Fujii Masao [1]. I p