postgresql/src/backend
Amit Kapila 08458bcaea 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:42:56 +05:30
..
access Fix pgstat_count_io_op_time() calls passing incorrect information 2026-06-17 16:05:37 +09:00
archive Update copyright for 2025 2025-01-01 11:21:55 -05:00
backup Fix incorrect errno in OpenWalSummaryFile() 2026-02-03 11:25:14 +09:00
bootstrap Remove unnecessary (char *) casts [mem] 2025-02-12 08:50:13 +01:00
catalog Remove inappropriate translation marker in getObjectIdentityParts(). 2026-06-08 15:24:02 -04:00
commands Clean up quoting of variable strings within replication commands. 2026-06-15 15:35:37 -04:00
executor Fix incorrect logic for hashed IN / NOT IN with non-strict operators 2026-04-24 14:03:41 +12:00
foreign Track the number of presorted outer pathkeys in MergePath 2025-05-08 18:21:32 +09:00
jit Fix another case of indirectly casting away const. 2026-06-04 11:37:43 -04:00
lib Correct list of files in src/backend/lib/README 2025-06-27 09:31:23 +09:00
libpq Fix compilation with OpenSSL 4 2026-06-12 13:57:22 +02:00
main Avoid possible crash within libsanitizer. 2025-11-05 11:09:30 -05:00
nodes IS JSON/JSON(): Protect against expressions uncoercible to text 2026-06-11 16:17:58 +02:00
optimizer Fix missed checks for hashability of container-type equality. 2026-06-08 11:48:17 -04:00
parser IS JSON/JSON(): Protect against expressions uncoercible to text 2026-06-11 16:17:58 +02:00
partitioning Strip PlaceHolderVars from partition pruning operands 2026-04-09 16:43:28 +09:00
po Translation updates 2026-05-11 13:03:08 +02:00
port Don't treat EINVAL from semget() as a hard failure. 2025-08-13 11:59:47 -04:00
postmaster Fix orphaned processes when startup process fails during PM_STARTUP 2026-04-21 09:40:03 +09:00
regex Harden our regex engine against integer overflow in size calculations. 2026-05-11 05:13:47 -07:00
replication Avoid stale slot access after dropping obsolete synced slots. 2026-06-18 09:42:56 +05:30
rewrite Fix UPDATE/DELETE ... WHERE CURRENT OF on a table with virtual columns. 2026-04-22 11:50:18 +01:00
snowball Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
statistics Fix size check in statext_dependencies_deserialize() 2026-05-25 14:38:59 +09:00
storage Fix race between ProcSignalInit() and EmitProcSignalBarrier(). 2026-05-27 16:25:59 -07:00
tcop Fix unbounded recursive handling of SSL/GSS in ProcessStartupPacket() 2026-05-11 05:13:47 -07:00
tsearch dict_synonym.c: remove incorrect outlen. 2026-06-08 11:47:40 -07:00
utils Fix PANIC with track_functions due to concurrent drop of pgstats entries 2026-06-18 11:49:34 +09:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
Makefile Fix build inconsistency due to the generation of wait-event code 2026-02-02 08:02:59 +09:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00
nls.mk Return yyparse() result not via global variable 2025-01-24 06:55:39 +01:00