WaitEventSet resource leakage

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: WaitEventSet resource leakage
Date: 2023-03-09 18:51:09
Message-ID: 472235.1678387869@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

In [1] I wrote:

> PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
>> The following script:
>> [ leaks a file descriptor per error ]
>
> Yeah, at least on platforms where WaitEventSets own kernel file
> descriptors. I don't think it's postgres_fdw's fault though,
> but that of ExecAppendAsyncEventWait, which is ignoring the
> possibility of failing partway through. It looks like it'd be
> sufficient to add a PG_CATCH or PG_FINALLY block there to make
> sure the WaitEventSet is disposed of properly --- fortunately,
> it doesn't need to have any longer lifespan than that one
> function.

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.

regards, tom lane

[1] https://www.postgresql.org/message-id/423731.1678381075%40sss.pgh.pa.us

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2023-03-09 19:11:42 pgsql: Use ICU by default at initdb time.
Previous Message Jim Jones 2023-03-09 18:41:29 Re: [PATCH] Add pretty-printed XML output option