pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix inplace update buffer self-deadlock.
Date: Sat, 02 Nov 2024 16:08:47 +0000
Message-ID: <E1t7GgB-003cVb-UE@gemulon.postgresql.org> (raw)

Fix inplace update buffer self-deadlock.

A CacheInvalidateHeapTuple* callee might call
CatalogCacheInitializeCache(), which needs a relcache entry.  Acquiring
a valid relcache entry might scan pg_class.  Hence, to prevent
undetected LWLock self-deadlock, CacheInvalidateHeapTuple* callers must
not hold BUFFER_LOCK_EXCLUSIVE on buffers of pg_class.  Move the
CacheInvalidateHeapTupleInplace() before the BUFFER_LOCK_EXCLUSIVE.  No
back-patch, since I've reverted commit
243e9b40f1b2dd09d6e5bf91ebf6e822a2cd3704 from non-master branches.

Reported by Alexander Lakhin.  Reviewed by Alexander Lakhin.

Discussion: https://postgr.es/m/10ec0bc3-5933-1189-6bb8-5dec4114558e@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0bada39c83a150079567a6e97b1a25a198f30ea3

Modified Files
--------------
src/backend/access/heap/heapam.c | 21 +++++++++++++--------
src/backend/utils/cache/inval.c  | 12 ++++++++++++
src/include/utils/inval.h        |  1 +
3 files changed, 26 insertions(+), 8 deletions(-)



Message-ID: <E1t7GgB-003cVb-UE@gemulon.postgresql.org>
Permalink:  ../E1t7GgB-003cVb-UE@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1t7GgB-003cVb-UE@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: noah@leadboat.com, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix inplace update buffer self-deadlock.
  In-Reply-To: <E1t7GgB-003cVb-UE@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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox