From: Michael Paquier <michael@paquier.xyz>
To: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Alexander Lakhin <exclusion@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Unexpected behavior after OOM errors
Date: Fri, 19 Jun 2026 08:29:03 +0900
Message-ID: <ajR_Py8uB9Vn56W6@paquier.xyz> (raw)
In-Reply-To: <CAEze2WiAbGykWpFTXbq6C9ZtXbSApbzLewpBkFjwhqrVuPy2gw@mail.gmail.com>
References: <e77acaac-a1b3-40b3-99ee-5769b4e453e4@gmail.com>
<CAEze2Wgktuo+_QWfbALRW-UXXZhbSC+OgGGDFDV9m_BLy5KozQ@mail.gmail.com>
<ajN2DkXPOzzC1GSj@paquier.xyz>
<CAEze2WiAbGykWpFTXbq6C9ZtXbSApbzLewpBkFjwhqrVuPy2gw@mail.gmail.com>
On Thu, Jun 18, 2026 at 05:27:57PM +0200, Matthias van de Meent wrote:
> By moving StandbyAcquireAccessExclusiveLock's LockAcquire ahead of
> when it links the lock to the transaction, the local data structure
> doesn't know to clean up the lock until after it's acquired, so
> failure in that process won't make error cleanup try to clean up the
> lock.
Yep, reordering these two actions would take care of the list
inconsistency where the startup process goes down following the ERROR
promoted to a FATAL.
I have been fingering the idea of backpatching this fix for a few
minutes, actually, but discarded the idea at the end. It does not
require a random pattern to cause the failure, being actionable
through a combination of GUCs as Alexander has proved. Still, the
only consequence is an extra LOG entry telling that the lock is not
being tracked for non-assert builds. Confusing, OK, but not really
critical.
Comments?
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: michael@paquier.xyz, boekewurm+postgres@gmail.com, hlinnaka@iki.fi, exclusion@gmail.com
Subject: Re: Unexpected behavior after OOM errors
In-Reply-To: <ajR_Py8uB9Vn56W6@paquier.xyz>
References: <e77acaac-a1b3-40b3-99ee-5769b4e453e4@gmail.com> <CAEze2Wgktuo+_QWfbALRW-UXXZhbSC+OgGGDFDV9m_BLy5KozQ@mail.gmail.com> <ajN2DkXPOzzC1GSj@paquier.xyz> <CAEze2WiAbGykWpFTXbq6C9ZtXbSApbzLewpBkFjwhqrVuPy2gw@mail.gmail.com> <ajR_Py8uB9Vn56W6@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox