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-09T17:33:44Z
Lists: pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> On 2025-10-09 12:50:53 -0400, Tom Lane wrote:
>> Concretely, like the attached.  This passes check-world, but
>> I can't test it under valgrind because I'm hitting the same
>> CREATE DATABASE failure skink is reporting.

> Sorry, was working on a fix when life rudely intervened.  Here's a quick
> temporary fix:

Thanks.  With that, I've confirmed that this change suppresses the
leak report in your example, and it also gets through the core
regression tests under valgrind (though I didn't run leak checking
for that).  That's enough to convince me that the fix is OK.

Do you have an opinion on whether to back-patch?  I'm leaning
in the direction of doing so, but it could be argued that it's
too much risk for a problem that we only know for sure exists
in master.

			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().