Re: Unexpected changes of CurrentResourceOwner and CurrentMemoryContext - Mailing list pgsql-hackers

From Álvaro Herrera
Subject Re: Unexpected changes of CurrentResourceOwner and CurrentMemoryContext
Date
Msg-id 202509121703.y7nfmqwotmfv@alvherre.pgsql
Whole thread Raw
In response to Re: Unexpected changes of CurrentResourceOwner and CurrentMemoryContext  (Antonin Houska <ah@cybertec.at>)
Responses Re: Unexpected changes of CurrentResourceOwner and CurrentMemoryContext
List pgsql-hackers
On 2025-Sep-12, Antonin Houska wrote:

> Euler Taveira <euler@eulerto.com> wrote:
> 
> > Interesting. I'm wondering that if this patch is applied we could remove the
> > following code [...] from pg_logical_slot_get_changes_guts and
> > LogicalSlotAdvanceAndCheckSnapState functions too. IIUC the referred
> > code is a band-aid that will be improved someday.
> 
> Even though we're fixing the likely reason of this problem, we cannot be 100%
> sure that no other problem like this still exists. So I'd not remove this
> assignment. Maybe add Assert(CurrentResourceOwner == old_resowner) in front of
> that, and adjust the comment?

Yeah, I'm going to risk removing it, because if we don't do it now,
we're never going to do it.  We can mitigate the risk of missing
remaining bugs by having that assertion you suggest, so that if anyone
actually hits a problem here, we'll know soon enough.

I have pushed it with that change.  I'll also add an open item for pg19
so that we remember to come back to remove the assertions, if we feel we
no longer need them.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"Update: super-fast reaction on the Postgres bugs mailing list. The report
was acknowledged [...], and a fix is under discussion.
The wonders of open-source !"
             https://twitter.com/gunnarmorling/status/1596080409259003906



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: ABI Compliance Checker GSoC Project
Next
From: Jeff Davis
Date:
Subject: Re: PostgreSQL 18 GA press release draft