postgresql/src
Amit Kapila ea834d747d 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
2026-06-18 09:35:53 +05:30
..
backend Avoid stale slot access after dropping obsolete synced slots. 2026-06-18 09:35:53 +05:30
bin Clean up quoting of variable strings within replication commands. 2026-06-15 15:35:37 -04:00
common Fix off-by-one with NFC recomposition for Hangul U+11A7 (TBASE) 2026-06-05 07:50:13 +09:00
fe_utils psql: Fix expanded aligned output 2026-06-08 14:37:57 +09:00
include Fix PANIC with track_functions due to concurrent drop of pgstats entries 2026-06-18 11:49:36 +09:00
interfaces Fix PQdescribePrepared with more than 7498 params 2026-06-15 11:35:41 +03:00
makefiles Optimize pg_popcount() with AVX-512 instructions. 2024-04-06 21:56:23 -05:00
pl Make plpgsql_trap test more robust and less resource-intensive. 2026-04-21 10:54:39 -04:00
port Prevent path traversal in pg_basebackup and pg_rewind 2026-05-11 05:13:49 -07:00
template
test Fix another instability in recovery TAP test 004_timeline_switch 2026-06-17 08:42:09 +09:00
timezone Guard against unsafe conditions in usage of pg_strftime(). 2026-05-11 05:13:49 -07:00
tools Modernize pg_bsd_indent's error/warning reporting code. 2026-06-15 12:22:55 -04:00
tutorial
.gitignore
DEVELOPERS
Makefile
Makefile.global.in Don't put library-supplied -L/-I switches before user-supplied ones. 2025-07-29 15:17:41 -04:00
Makefile.shlib
meson.build
nls-global.mk Fix update-po for the PGXS case 2025-10-16 20:21:05 +02:00