Re: waiteventset.c XXX

From: Andres Freund <andres(at)anarazel(dot)de>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Subject: Re: waiteventset.c XXX
Date: 2025-09-22 15:41:17
Message-ID: jty4rzauj2ckz3cp4z2senzq6wq3hyfqbrulxiuo2jaqxmke7l@fny6o5pwdsvn
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2025-09-22 17:23:33 +0200, Álvaro Herrera wrote:
> On 2025-Sep-18, Robert Haas wrote:
>
> > I submit that we should not have both a comment that says we must save
> > and restore errno and code that doesn't. Maybe the comment is intended
> > to imply that the caller should be doing such a save and restore, but
> > if so, then (a) that's not very clear from the wording and (b) why the
> > XXX?
>
> I understand the comment as saying that the caller should do
> save/restore of errno. However, looking at several places that are
> calling SetLatch() (which is the only caller of this function) it
> appears that at least several of them have actually forgotten to do so
> (didn't scan all of them but checked a couple and they weren't doing
> it). I think what you have found is not just a bogus comment, but an
> actual bug or class of bugs.

These days pqsignal saves/restores errno in a wrapper around signal
handlers. So at least in newer branches this shouldn't be an issue when called
from signal handlers.

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2025-09-22 15:41:41 Re: Trivial fix for comment of function table_tuple_lock
Previous Message Jonathan S. Katz 2025-09-22 15:38:55 Re: Having postgresql.org link to cgit instead of gitweb