public inbox for [email protected]help / color / mirror / Atom feed
pgsql: Fix race in ReplicationSlotRelease() for ephemeral slots 6+ messages / 1 participants [nested] [flat]
* pgsql: Fix race in ReplicationSlotRelease() for ephemeral slots @ 2026-06-03 09:48 Fujii Masao <[email protected]> 0 siblings, 0 replies; 6+ messages in thread From: Fujii Masao @ 2026-06-03 09:48 UTC (permalink / raw) To: [email protected] Fix race in ReplicationSlotRelease() for ephemeral slots When releasing an ephemeral replication slot, ReplicationSlotRelease() drops the slot via ReplicationSlotDropAcquired(). However, after dropping the slot, ReplicationSlotRelease() continued to use its local "slot" pointer, which still referenced the dropped slot's former shared-memory entry. It could then update fields such as effective_xmin in that entry. Once an ephemeral slot has been dropped (via ReplicationSlotDropAcquired()), its slot array entry can be reused immediately by another backend creating a new slot. As a result, those updates could corrupt the state of an unrelated replication slot. Fix by skipping those shared-memory updates for phemeral slots and performing them only for non-ephemeral slots, whose shared-memory entries remain valid after release. Backpatch to all supported versions. Author: Zhijie Hou <[email protected]> Reviewed-by: Masao Fujii <[email protected]> Reviewed-by: Srinath Reddy Sadipiralla <[email protected]> Reviewed-by: Xuneng Zhou <[email protected]> Discussion: https://postgr.es/m/TY4PR01MB177184FF9EE916F577E1F554194082@TY4PR01MB17718.jpnprd01.prod.outlook.com Backpatch-through: 14 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/f2081a7800f1696cb0415bacd655cb41b7b9ca63 Modified Files -------------- src/backend/replication/slot.c | 68 ++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 33 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix race in ReplicationSlotRelease() for ephemeral slots @ 2026-06-03 09:49 Fujii Masao <[email protected]> 0 siblings, 0 replies; 6+ messages in thread From: Fujii Masao @ 2026-06-03 09:49 UTC (permalink / raw) To: [email protected] Fix race in ReplicationSlotRelease() for ephemeral slots When releasing an ephemeral replication slot, ReplicationSlotRelease() drops the slot via ReplicationSlotDropAcquired(). However, after dropping the slot, ReplicationSlotRelease() continued to use its local "slot" pointer, which still referenced the dropped slot's former shared-memory entry. It could then update fields such as effective_xmin in that entry. Once an ephemeral slot has been dropped (via ReplicationSlotDropAcquired()), its slot array entry can be reused immediately by another backend creating a new slot. As a result, those updates could corrupt the state of an unrelated replication slot. Fix by skipping those shared-memory updates for phemeral slots and performing them only for non-ephemeral slots, whose shared-memory entries remain valid after release. Backpatch to all supported versions. Author: Zhijie Hou <[email protected]> Reviewed-by: Masao Fujii <[email protected]> Reviewed-by: Srinath Reddy Sadipiralla <[email protected]> Reviewed-by: Xuneng Zhou <[email protected]> Discussion: https://postgr.es/m/TY4PR01MB177184FF9EE916F577E1F554194082@TY4PR01MB17718.jpnprd01.prod.outlook.com Backpatch-through: 14 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f833c92077a1ba7fd8bb5d51dc466409e2fd33b0 Modified Files -------------- src/backend/replication/slot.c | 68 ++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 33 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix race in ReplicationSlotRelease() for ephemeral slots @ 2026-06-03 09:49 Fujii Masao <[email protected]> 0 siblings, 0 replies; 6+ messages in thread From: Fujii Masao @ 2026-06-03 09:49 UTC (permalink / raw) To: [email protected] Fix race in ReplicationSlotRelease() for ephemeral slots When releasing an ephemeral replication slot, ReplicationSlotRelease() drops the slot via ReplicationSlotDropAcquired(). However, after dropping the slot, ReplicationSlotRelease() continued to use its local "slot" pointer, which still referenced the dropped slot's former shared-memory entry. It could then update fields such as effective_xmin in that entry. Once an ephemeral slot has been dropped (via ReplicationSlotDropAcquired()), its slot array entry can be reused immediately by another backend creating a new slot. As a result, those updates could corrupt the state of an unrelated replication slot. Fix by skipping those shared-memory updates for phemeral slots and performing them only for non-ephemeral slots, whose shared-memory entries remain valid after release. Backpatch to all supported versions. Author: Zhijie Hou <[email protected]> Reviewed-by: Masao Fujii <[email protected]> Reviewed-by: Srinath Reddy Sadipiralla <[email protected]> Reviewed-by: Xuneng Zhou <[email protected]> Discussion: https://postgr.es/m/TY4PR01MB177184FF9EE916F577E1F554194082@TY4PR01MB17718.jpnprd01.prod.outlook.com Backpatch-through: 14 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/080d61f07ce2852aff32b05aba5c417bad8859d2 Modified Files -------------- src/backend/replication/slot.c | 76 ++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 37 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix race in ReplicationSlotRelease() for ephemeral slots @ 2026-06-03 09:49 Fujii Masao <[email protected]> 0 siblings, 0 replies; 6+ messages in thread From: Fujii Masao @ 2026-06-03 09:49 UTC (permalink / raw) To: [email protected] Fix race in ReplicationSlotRelease() for ephemeral slots When releasing an ephemeral replication slot, ReplicationSlotRelease() drops the slot via ReplicationSlotDropAcquired(). However, after dropping the slot, ReplicationSlotRelease() continued to use its local "slot" pointer, which still referenced the dropped slot's former shared-memory entry. It could then update fields such as effective_xmin in that entry. Once an ephemeral slot has been dropped (via ReplicationSlotDropAcquired()), its slot array entry can be reused immediately by another backend creating a new slot. As a result, those updates could corrupt the state of an unrelated replication slot. Fix by skipping those shared-memory updates for phemeral slots and performing them only for non-ephemeral slots, whose shared-memory entries remain valid after release. Backpatch to all supported versions. Author: Zhijie Hou <[email protected]> Reviewed-by: Masao Fujii <[email protected]> Reviewed-by: Srinath Reddy Sadipiralla <[email protected]> Reviewed-by: Xuneng Zhou <[email protected]> Discussion: https://postgr.es/m/TY4PR01MB177184FF9EE916F577E1F554194082@TY4PR01MB17718.jpnprd01.prod.outlook.com Backpatch-through: 14 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/51e79222c949c844109d3e1bcdc26a6bd0c0508b Modified Files -------------- src/backend/replication/slot.c | 52 ++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 25 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix race in ReplicationSlotRelease() for ephemeral slots @ 2026-06-03 09:49 Fujii Masao <[email protected]> 0 siblings, 0 replies; 6+ messages in thread From: Fujii Masao @ 2026-06-03 09:49 UTC (permalink / raw) To: [email protected] Fix race in ReplicationSlotRelease() for ephemeral slots When releasing an ephemeral replication slot, ReplicationSlotRelease() drops the slot via ReplicationSlotDropAcquired(). However, after dropping the slot, ReplicationSlotRelease() continued to use its local "slot" pointer, which still referenced the dropped slot's former shared-memory entry. It could then update fields such as effective_xmin in that entry. Once an ephemeral slot has been dropped (via ReplicationSlotDropAcquired()), its slot array entry can be reused immediately by another backend creating a new slot. As a result, those updates could corrupt the state of an unrelated replication slot. Fix by skipping those shared-memory updates for phemeral slots and performing them only for non-ephemeral slots, whose shared-memory entries remain valid after release. Backpatch to all supported versions. Author: Zhijie Hou <[email protected]> Reviewed-by: Masao Fujii <[email protected]> Reviewed-by: Srinath Reddy Sadipiralla <[email protected]> Reviewed-by: Xuneng Zhou <[email protected]> Discussion: https://postgr.es/m/TY4PR01MB177184FF9EE916F577E1F554194082@TY4PR01MB17718.jpnprd01.prod.outlook.com Backpatch-through: 14 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/a4eb59d40f278471d5b83a25cef6e56bc997e696 Modified Files -------------- src/backend/replication/slot.c | 52 ++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 25 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix race in ReplicationSlotRelease() for ephemeral slots @ 2026-06-03 09:49 Fujii Masao <[email protected]> 0 siblings, 0 replies; 6+ messages in thread From: Fujii Masao @ 2026-06-03 09:49 UTC (permalink / raw) To: [email protected] Fix race in ReplicationSlotRelease() for ephemeral slots When releasing an ephemeral replication slot, ReplicationSlotRelease() drops the slot via ReplicationSlotDropAcquired(). However, after dropping the slot, ReplicationSlotRelease() continued to use its local "slot" pointer, which still referenced the dropped slot's former shared-memory entry. It could then update fields such as effective_xmin in that entry. Once an ephemeral slot has been dropped (via ReplicationSlotDropAcquired()), its slot array entry can be reused immediately by another backend creating a new slot. As a result, those updates could corrupt the state of an unrelated replication slot. Fix by skipping those shared-memory updates for phemeral slots and performing them only for non-ephemeral slots, whose shared-memory entries remain valid after release. Backpatch to all supported versions. Author: Zhijie Hou <[email protected]> Reviewed-by: Masao Fujii <[email protected]> Reviewed-by: Srinath Reddy Sadipiralla <[email protected]> Reviewed-by: Xuneng Zhou <[email protected]> Discussion: https://postgr.es/m/TY4PR01MB177184FF9EE916F577E1F554194082@TY4PR01MB17718.jpnprd01.prod.outlook.com Backpatch-through: 14 Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/968c508457b3542387c5ee47426565dd20846ab0 Modified Files -------------- src/backend/replication/slot.c | 52 ++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 25 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2026-06-03 09:49 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-06-03 09:48 pgsql: Fix race in ReplicationSlotRelease() for ephemeral slots Fujii Masao <[email protected]> 2026-06-03 09:49 pgsql: Fix race in ReplicationSlotRelease() for ephemeral slots Fujii Masao <[email protected]> 2026-06-03 09:49 pgsql: Fix race in ReplicationSlotRelease() for ephemeral slots Fujii Masao <[email protected]> 2026-06-03 09:49 pgsql: Fix race in ReplicationSlotRelease() for ephemeral slots Fujii Masao <[email protected]> 2026-06-03 09:49 pgsql: Fix race in ReplicationSlotRelease() for ephemeral slots Fujii Masao <[email protected]> 2026-06-03 09:49 pgsql: Fix race in ReplicationSlotRelease() for ephemeral slots Fujii Masao <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox