Re: Improve LWLock tranche name visibility across backends

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Sami Imseih <samimseih(at)gmail(dot)com>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>, Rahila Syed <rahilasyed90(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Improve LWLock tranche name visibility across backends
Date: 2025-08-29 07:05:14
Message-ID: aLFRKhy6pIz/B8/C@ip-10-97-1-34.eu-west-3.compute.internal
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Thu, Aug 28, 2025 at 05:53:23PM -0500, Sami Imseih wrote:
> Just a few things that were discussed earlier, that I incorporated now.
>
> 1/ We should be checking that tranche_name is NOT NULL when
> LWLockNewTrancheId or RequestNamedLWLockTranche is called.

Right, if not strlen() does segfault.

In addition to checking for NULL, should we also check for empty string? Currently,
the patch does accept strlen(tranche_name) == 0.

> Also check for the length of the tranche name inside
> RequestNamedLWLockTranche, instead of relying on an Assert to check
> the length. I think that is much safer.

Same remark as above but in RequestNamedLWLockTranche().

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2025-08-29 07:13:01 Re: pg_dump: fix memory leak
Previous Message Xuneng Zhou 2025-08-29 07:04:20 Re: Add progressive backoff to XactLockTableWait functions