Re: Another WaitEventSet resource leakage in back branches

From: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Another WaitEventSet resource leakage in back branches
Date: 2024-04-12 11:21:24
Message-ID: CAPmGK14dPehfKNncTLdm1n19wM6muijG6WRJtQ5dustxxzmUeQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Andres,

On Fri, Apr 12, 2024 at 1:29 AM Andres Freund <andres(at)anarazel(dot)de> wrote:
> On 2024-03-22 21:15:45 +0900, Etsuro Fujita wrote:
> > While working on [1], I noticed $SUBJECT: WaitLatchOrSocket in back
> > branches is ignoring the possibility of failing partway through, too.
> > I added a PG_FAINALLY block to that function, like commit 555276f85.
> > Patch attached.
>
> Could you expand a bit on the concrete scenario you're worried about here?
> PG_TRY/CATCH aren't free, so adding something like this to a quite common
> path, in the back branches, without a concrete analysis as to why it's needed,
> seems a bit scary.

What I am worried about is that system calls used in
WaitLatchOrSocket, like epoll_ctl, might fail, throwing an error
(epoll_ctl might fail due to eg, ENOMEM or ENOSPC). The probability
of such failures would be pretty low, but not zero.

This causes more problems than it solves?

Thanks for the comment!

Best regards,
Etsuro Fujita

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2024-04-12 11:54:50 Re: promotion related handling in pg_sync_replication_slots()
Previous Message Amit Kapila 2024-04-12 10:47:53 Re: promotion related handling in pg_sync_replication_slots()