agora inbox for pgsql-committers@postgresql.orghelp / color / mirror / Atom feed
pgsql: Avoid stale slot access after dropping obsolete synced slots. 3+ messages / 1 participants [nested] [flat]
* pgsql: Avoid stale slot access after dropping obsolete synced slots. @ 2026-06-18 04:27 Amit Kapila <akapila@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Amit Kapila @ 2026-06-18 04:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Avoid stale slot access after dropping obsolete synced slots. @ 2026-06-18 04:27 Amit Kapila <akapila@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Amit Kapila @ 2026-06-18 04:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/08458bcaea5bc893c6150cc86adbac259a5d7b36 Modified Files -------------- src/backend/replication/logical/slotsync.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Avoid stale slot access after dropping obsolete synced slots. @ 2026-06-18 04:27 Amit Kapila <akapila@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Amit Kapila @ 2026-06-18 04:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/ea834d747d454c4fd66b08ebecaa9483476cf4a4 Modified Files -------------- src/backend/replication/logical/slotsync.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2026-06-18 04:27 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-06-18 04:27 pgsql: Avoid stale slot access after dropping obsolete synced slots. Amit Kapila <akapila@postgresql.org> 2026-06-18 04:27 pgsql: Avoid stale slot access after dropping obsolete synced slots. Amit Kapila <akapila@postgresql.org> 2026-06-18 04:27 pgsql: Avoid stale slot access after dropping obsolete synced slots. Amit Kapila <akapila@postgresql.org>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox