Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1whlcW-000PKP-2M for pgsql-bugs@arkaria.postgresql.org; Thu, 09 Jul 2026 10:04:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1whlcV-00CN9H-0p for pgsql-bugs@arkaria.postgresql.org; Thu, 09 Jul 2026 10:04:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1whkZ9-00C6Gh-28 for pgsql-bugs@lists.postgresql.org; Thu, 09 Jul 2026 08:57:08 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1whkZ7-00000000RO6-0nrm for pgsql-bugs@lists.postgresql.org; Thu, 09 Jul 2026 08:57:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=Yqa1Ykobc+eWov0fBp/QijVUdL1b/+rNImDezYhQZ/A=; b=kN9AyV979nYrLaYwOXP/u2Lb+g vLi8np6Lk2rYCwXK8OwWkaOdO5ObuaTE1n7tswbUSNOmpgK02PeB9aDR5VH6Vvkkb/as1LVtANGNn QL8s+fdXyvoghXyNf3L7Dar7olL7JJIdkxUOjX7+r4jZxb182oQOmMCU5Oo7I6kHAaPJ1J4e+ZAB9 Okf4wkMEcshZnY6gKAKX11Ydi/BqLczzIKJh7SIT8ZaQSIE4Bym6XrkputlbwKadh1KCD2fezDj2v LqCdykDP60bLxXMu31IkpcpOQkuIXwasRSPyCOGtZWkboHGnvvqSZw+7brrBp8zJKRsEP8SxxslVC NiyFvMVg==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1whkZ5-000ylt-2V for pgsql-bugs@lists.postgresql.org; Thu, 09 Jul 2026 08:57:04 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1whkZ3-002UVS-1F for pgsql-bugs@lists.postgresql.org; Thu, 09 Jul 2026 08:57:02 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19549: Physical replication slot xmin value stuck To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: nmangnale2@gmail.com Reply-To: nmangnale2@gmail.com, pgsql-bugs@lists.postgresql.org Date: Thu, 09 Jul 2026 08:57:00 +0000 Message-ID: <19549-07705fbe7e2bca99@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk The following bug has been logged on the website: Bug reference: 19549 Logged by: nitin mangnale Email address: nmangnale2@gmail.com PostgreSQL version: Unsupported/Unknown Operating system: Linux (ubuntu 22.04 LTS) Description: =20 Hello PostgreSQL Community, I am looking for assistance in investigating what appears to be an unusual replication/xmin behavior on PostgreSQL 13.20. Environment - PostgreSQL Version: 13.20 (Community PostgreSQL) - Replication Type: Physical Streaming Replication - Primary Server: 1 - Standby Servers: 2 - Replication Slots: Physical replication slots - One standby is used primarily as a reporting/read-only node. - "hot_standby_feedback" is enabled. Problem Description One of our standby servers periodically causes a physical replication slot on the primary to retain a very old "xmin". The "age(xmin)" continuously increases over time, preventing vacuum from advancing normally on the primary. The unusual part is that we cannot identify any backend or query responsible for holding the snapshot. The issue only affects one standby. The second standby remains healthy. Restarting the affected standby immediately clears the problem, but after several days the same behavior returns. Observed Behavior On the primary: SELECT now(), slot_name, slot_type, active, xmin, age(xmin), catalog_xmin, restart_lsn FROM pg_replication_slots ORDER BY age(xmin) DESC NULLS LAST; Example output: slot_name : oseu2012766 slot_type : physical active : true xmin : 788928341 age(xmin) : 5419501 (continuously increasing) restart_lsn : 1835DD/EB000000 The second standby slot behaves normally: slot_name : oseu2012755 age(xmin) : ~6000 --- On the primary: SELECT application_name, backend_xmin, age(backend_xmin), state, sync_state FROM pg_stat_replication; Output: application_name | backend_xmin | state -----------------+--------------+---------- walreceiver | NULL | streaming walreceiver | NULL | streaming "backend_xmin" is NULL for both standby connections. --- On the affected standby: We checked: - pg_stat_activity - long-running transactions - idle in transaction sessions - backend_xmin - xact_start No session appears to hold the reported xmin. Example: SELECT pid, usename, application_name, backend_xmin, age(backend_xmin), state, query FROM pg_stat_activity WHERE backend_xmin =3D 788928341; Returns: 0 rows We also reviewed all active sessions and found only short-running reporting queries (generally under 20 seconds). --- Replication Status - Replication lag: None - WAL receiver: Healthy - WAL replay: Normal - Physical replication slot remains active --- Database Conflicts SELECT * FROM pg_stat_database_conflicts; Output: confl_snapshot =3D 0 confl_lock =3D 0 confl_deadlock =3D 0 confl_bufferpin =3D 20 --- Actions Already Performed We have verified: - No long-running queries - No idle-in-transaction sessions - No prepared transactions - No replication lag - No obvious replication slot issues - No backend_xmin matching the slot xmin - WAL receiver appears healthy - Reporting queries are relatively short-lived Restarting only the affected standby immediately releases the pinned xmin and vacuum resumes normally. However, after a few days, the same standby again begins holding an old xmin. The second standby does not exhibit this behavior. Questions 1. Is this a known issue or edge case in PostgreSQL 13.20 involving physical replication slots or hot_standby_feedback? 2. Is it expected for "pg_replication_slots.xmin" to remain pinned while "pg_stat_replication.backend_xmin" is NULL? 3. Are there any known bugs in PostgreSQL 13.x related to stale standby feedback or snapshot lifecycle that match this behavior? 4. Are there any additional internal views, debugging techniques, or GUC parameters that would help identify the source of the pinned xmin? 5. Would upgrading to a newer PostgreSQL major version be expected to resolve this behavior if it is related to snapshot or hot standby feedback handling? At this point we are considering rebuilding the affected standby, but we would like to understand the root cause before doing so. Any guidance would be greatly appreciated. Thank you.