agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Amit Kapila <akapila@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid stale slot access after dropping obsolete synced slots.
Date: Thu, 18 Jun 2026 04:27:19 +0000
Message-ID: <E1wa4LX-000opD-0s@gemulon.postgresql.org> (raw)
Avoid stale slot access after dropping obsolete synced slots.
drop_local_obsolete_slots() continued to dereference local_slot after
calling ReplicationSlotDropAcquired(). Once the slot is dropped, its
entry in the slot array can be reused by another backend, so later reads
of local_slot->data could observe a different slot's name or database
OID, leading to an incorrect unlock and log message.
Save the slot name and database OID before performing the drop, and use
the saved values for the subsequent UnlockSharedObject() call and the log
message. While at it, emit the "dropped replication slot" message only
when a slot was actually dropped, rather than unconditionally.
Author: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Backpatch-through: 17, where it was introduced
Discussion: https://postgr.es/m/TY4PR01MB177184FF9EE916F577E1F554194082@TY4PR01MB17718.jpnprd01.prod.outlook.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/bdae2c20e88d80c63bd8de2c57aebd9cea590bc7
Modified Files
--------------
src/backend/replication/logical/slotsync.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
view thread (3+ messages) latest in thread
Message-ID: <E1wa4LX-000opD-0s@gemulon.postgresql.org>
Permalink: ../E1wa4LX-000opD-0s@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1wa4LX-000opD-0s@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: akapila@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Avoid stale slot access after dropping obsolete synced slots.
In-Reply-To: <E1wa4LX-000opD-0s@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