agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Make StandbyAcquireAccessExclusiveLock() more resilent with OOMs
Date: Sat, 20 Jun 2026 06:02:44 +0000
Message-ID: <E1waomy-0016NC-2T@gemulon.postgresql.org> (raw)

Make StandbyAcquireAccessExclusiveLock() more resilent with OOMs

In StandbyReleaseXidEntryLocks, a failure in acquiring a lock with
LockAcquire() due to an out-of-memory problem would lead to an
inconsistency with the lock state cached in the startup process,
impacting the list of RecoveryLockXidEntrys.  The code is updated here
so as the cached state is updated once the lock is acquired.

This problem is unlikely going to happen in practice.  Even if it were
to show up, it would translate to a LOG message for non-assert builds
(assertion failure otherwise), so no backpatch is done.  This commit is
in the same spirit as 29fb598b9cad, with a problem emulated by injecting
random failures for allocations.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/e77acaac-a1b3-40b3-99ee-5769b4e453e4@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b85f9c00fb8822eb2142c347ce529f651dbef178

Modified Files
--------------
src/backend/storage/ipc/standby.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)



Message-ID: <E1waomy-0016NC-2T@gemulon.postgresql.org>
Permalink:  ../E1waomy-0016NC-2T@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1waomy-0016NC-2T@gemulon.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Make StandbyAcquireAccessExclusiveLock() more resilent with OOMs
  In-Reply-To: <E1waomy-0016NC-2T@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox