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.94.2) (envelope-from ) id 1ujbd9-009j5v-R9 for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Aug 2025 10:44:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ujbd8-00Elrm-N6 for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Aug 2025 10:44:22 +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.94.2) (envelope-from ) id 1ujbd7-00ElrT-Su for pgsql-hackers@lists.postgresql.org; Wed, 06 Aug 2025 10:44:22 +0000 Received: from fout-b1-smtp.messagingengine.com ([202.12.124.144]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ujbd4-001340-3A for pgsql-hackers@postgresql.org; Wed, 06 Aug 2025 10:44:21 +0000 Received: from phl-compute-12.internal (phl-compute-12.internal [10.202.2.52]) by mailfout.stl.internal (Postfix) with ESMTP id CA27A1D00197; Wed, 6 Aug 2025 06:44:16 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Wed, 06 Aug 2025 06:44:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kurilemu.de; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to; s=fm1; t=1754477056; x= 1754563456; bh=PfsFmkkPA8I99NK5gYkFm4DqlLN/zSaMDXBGz50CZqI=; b=p PPp2DoD+D6PT+mf88sRHRV457qIzeUDKlggSodm1rA2jleh5lYxw/6uAFwpjOiZN AMjdIeeElGJhNvu1yXs60O3K1XbO1s9FdsHZQP8erbugb4ARzqJEIcmNb0Rit+uL 7I+pzciY5yEj+Hjio6V0utZll8JQZ1jSN20K1ybIbDF4tlrnLgxQfkMmtl8LWogl rcIeNPTvdVY00480Ao48uxThmUy2ugPyigBbSLSx12rHcjlVS3Iw0Lye4wNSyhjL tnGwya8XwfEBMuso1grfaE4DAfqzhS+CyISgrS9lJbCFRhncD1+kF0pEgd6+ppKT 889onVsU0YC/v6Ob9eJog== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1754477056; x=1754563456; bh=P fsFmkkPA8I99NK5gYkFm4DqlLN/zSaMDXBGz50CZqI=; b=apc6OjTSuTKOthrnd PhBT0ZgrvvLge27DR/1/w58U7+jXPLBmMKbvXkYYzawsh4FRSMxIL/64d1kY+cSX Ucr+HIxoTAlvRSFu3WL2UIj0jQXLk/4PO0w8j2Oc8oScvDzflo5SoS3Xwr0iVbpe lGAmXj4y2nYYL7wdVJF7YZoU8OrpfkUrEVumASyk1YAiChcGBN3qVOJheZaqOM6n DwAh99yPlhbYlAKShKNBD03HVsztzyaO7DwRr+5hyg7rwW9efxSRtG/kb0Aigaa1 H0Z7jt0Wg8Me+I2QvjmPFWry6B1TWNUYq+7ndPOyNr0XCd7mi31nPccPAXKn3jBP 3xXIQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduudejkeegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheplmhlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsehkuhhrihhlvghmuhdruggvqeenucggtf frrghtthgvrhhnpeetuedvheffkeevgfeuheevteevkefggedttdeufeeuheduuddthfef fffhjeefffenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgv sehkuhhrihhlvghmuhdruggvpdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpoh huthdprhgtphhtthhopeefuggrnhhishhsihhmohesghhmrghilhdrtghomhdprhgtphht thhopegrlhgvgigrnhgurhgrrdifrghnghdrohhsshesghhmrghilhdrtghomhdprhgtph htthhopehpghhsqhhlqdhhrggtkhgvrhhssehpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 6 Aug 2025 06:44:16 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurilemu.de; s=schmee; t=1754477053; bh=a1ziJg5/KO9+mixjS7YhO0LW25VGmljGr5zLGmuOTKk=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=MExAPwQs++Eh5ORzQngfNWR3EY3N4fXfOXD2vGhdysDopbaOEqzl5dKaR5l38uc0t uIS/3Ui31TzmwbJqxVIzI9IYOqSCQy0aGbg1OZw6Pr9luh9GreEdx741xPblRUeEk2 JqtHXCsrnCb/cGBsMbBmQvesGTgoHJBrO+iQJjx36DW5N/30u8+kiecxjaG11s6mYX l4eOjBZ6IKVv/bIc8iK8y+2tKsd63JycW9i4IjCPdbRQOcQouKGLIUd4RnXJViAJxR 1ls/J6X0Es4wkPPmjosGhOBY5U5eO+DjLuo7nBW5mbBi8OxIsTaZlXuV/gRwASFXSy EhGjd8uPQoRkw== Received: by schmee.kurilemu.internal (Postfix, from userid 1000) id 5D2CD90; Wed, 6 Aug 2025 12:44:13 +0200 (CEST) Date: Wed, 6 Aug 2025 12:44:13 +0200 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: Alexandra Wang Cc: Daniil Davydov <3danissimo@gmail.com>, PostgreSQL Hackers Subject: Re: LISTEN/NOTIFY bug: VACUUM sets frozenxid past a xid in async queue Message-ID: <202508061044.ptcyt7aqsaaa@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025-Aug-05, Alexandra Wang wrote: > I'm bringing up a bug that was reported multiple times [1][2][3] in > the bugs list here, for a broader audience. > > The issue is that an ERROR like the one below occurs when trying to > register any listener in the database. > > test=# listen c21; > ERROR: 58P01: could not access status of transaction 14279685 > DETAIL: Could not open file "pg_xact/000D": No such file or directory. > LOCATION: SlruReportIOError, slru.c:1087 Oh, interesting problem. Many thanks for the excellent write-up. > My questions: > > 1. Is it acceptable to drop notifications from the async queue if > there are no active listeners? There might still be notifications that > haven’t been read by any previous listener. I'm somewhat wary of this idea -- could these inactive listeners become active later and expect to be able to read their notifies? > 2. If the answer to 1 is no, how can we teach VACUUM to respect the > minimum xid stored in all AsyncQueueEntries? Maybe we can have AsyncQueueAdvanceTail return the oldest XID of listeners, and back off the pg_clog truncation based on that. This could be done by having a new boolean argument that says to look up the XID from the PGPROC using BackendPidGetProc(QUEUE_BACKEND_PID) (which would only be passed true by vac_update_datfrozenxid(), to avoid overhead by other callers), then collect the oldest of those and return it. This does create the problem that an inactive listener could cause the XID counter to stay far in the past. Maybe we could try to avoid this by adding more signalling (e.g, AsyncQueueAdvanceTail() itself could send PROCSIG_NOTIFY_INTERRUPT signal?), and terminating backends that are way overdue on reading notifies. I'm not sure if this is really needed or useful; consider a backend stuck on SIGSTOP (debugger or whatever): it will just sit there forever. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/