Re: Adding some error context for lock wait failures

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Dilip Kumar <dilipbalaut@gmail.com>, Zhang Mingli <zmlpostgres@gmail.com>, pgsql-hackers@lists.postgresql.org, Steve Baldwin <steve.baldwin@gmail.com>
Date: 2025-10-09T18:43:26Z
Lists: pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> There are a few places that do
>     ereport(...);

>     /* Flush any strings created in ErrorContext */
>     FlushErrorState();

> That'd be obsoleted by this change, right?

Oh, I see them, all in guc.c.  Yeah, we should get rid of those;
they seem not too safe anyway given that they're unconditional.

>> Do you have an opinion on whether to back-patch?

> I'm a bit worried about it causing problems, although I don't have an actual
> theory as to how. So I'd slightly lean towards not backpatching. But it's just
> a vague gut feeling.

Fair enough.  We can always back-patch later if someone exhibits
an actual problem in the field.

			regards, tom lane



Commits

  1. Clean up memory leakage that occurs in context callback functions.

  2. Provide error context when an error is thrown within WaitOnLock().