Re: WaitEventSet resource leakage

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Alexander Lakhin <exclusion(at)gmail(dot)com>
Subject: Re: WaitEventSet resource leakage
Date: 2023-11-16 10:21:49
Message-ID: d34c3d92-e629-4932-8ff8-e56796883e63@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 16/11/2023 01:08, Tom Lane wrote:
> Heikki Linnakangas <hlinnaka(at)iki(dot)fi> writes:
>> On 09/03/2023 20:51, Tom Lane wrote:
>>> After further thought that seems like a pretty ad-hoc solution.
>>> We probably can do no better in the back branches, but shouldn't
>>> we start treating WaitEventSets as ResourceOwner-managed resources?
>>> Otherwise, transient WaitEventSets are going to be a permanent
>>> source of headaches.
>
>> Let's change it so that it's always allocated in TopMemoryContext, but
>> pass a ResourceOwner instead:
>> WaitEventSet *
>> CreateWaitEventSet(ResourceOwner owner, int nevents)
>> And use owner == NULL to mean session lifetime.
>
> WFM. (I didn't study your back-branch patch.)

And here is a patch to implement that on master.

--
Heikki Linnakangas
Neon (https://neon.tech)

Attachment Content-Type Size
v1-0001-Use-ResourceOwner-to-track-WaitEventSets.patch text/x-patch 11.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2023-11-16 10:31:43 Re: add log messages when replication slots become active and inactive (was Re: Is it worth adding ReplicationSlot active_pid to ReplicationSlotPersistentData?)
Previous Message Alvaro Herrera 2023-11-16 10:21:32 Re: trying again to get incremental backup