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 1vGo73-004Q8I-2k for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Nov 2025 00:44:28 +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 1vGioa-003vqV-VC for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Nov 2025 19:05:04 +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 1vGioa-003vqN-JQ for pgsql-hackers@lists.postgresql.org; Wed, 05 Nov 2025 19:05:03 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vGioX-006ALS-0L for pgsql-hackers@postgresql.org; Wed, 05 Nov 2025 19:05:03 +0000 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-2956d816c10so2450395ad.1 for ; Wed, 05 Nov 2025 11:05:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762369378; x=1762974178; darn=postgresql.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=6f+NqAupyDwN4u2lNRpxRtKYbYHP73N7oNj1KxVJm7c=; b=F8gKQgZESlsMp6lDqMuq+u3rvi98kLfpYIKsRb5UqYRPMe3iydFcD/900zXnUsKvt1 KZ2NL40Vgx6k8ZBwFGpgI3c8XpseEAOQ4nEeg3hkhdzXqFiWbuGm/fySrMoCiq76SKxL HjiUEmgNGZg/c014l1iQGwa+LoGVwlORZ5hAVeL3tEXb2Znb7gpvXGS2gC1hjQS6y6Us 2sIxFcVEtOcDfBmhIl34IHCQrCT+bxMef/u1tBc24+dxv4Q46MVdqBUo8T10d82ED4uI hQNkfFUMpVCQxuLjnXZ/oGf6AOhwfK7LDZlUnx+fll21rdT5+FOaglPn5uD09WSkz4ZA G4Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762369378; x=1762974178; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=6f+NqAupyDwN4u2lNRpxRtKYbYHP73N7oNj1KxVJm7c=; b=vvF7T2DGME0myyhoLV2bbcwkBR10+iV0rHwzwljD38zHzrtShhIIulEJ+ZsAbfrJmu vLoI3VgL5FdBPwNzaGPhT609tLQWDHt0TSdN0qMJ++xTpj1Lfr8Q7lzTS1A7LIRM7hPZ 9vjkxFNAXoMyY4ukOId5tt2qh5p/p2ZsYNve+81w/P0YgswUYSyhL1DPVmZGe1jAsdu5 4HLDa1DZ+kGeB+RoMZBj//Hwt59rAy9ERVhpq1VRE4nALttHrw+gpr9Q2LcBUhlKKGzz TEwlKi0OkeE5NWcmDCn05BaIAWTqrAt4P4fp3Kxdenm6Z1Ny6Een5KOdAt1tXL04VlTs D/vg== X-Forwarded-Encrypted: i=1; AJvYcCWC5fkLE5YJeJKVGTN6eSY2sg5ZzT5Uuuht8yAeB+JB1x7nVOJ6DRMx7DNhn6r6jhfavsJhKltnttYgLuIN@postgresql.org X-Gm-Message-State: AOJu0Yzy0s5G2kL04J51fwQ3L9oZ/taRqtUkwZKM74WjJlwQh8TAJHKR He/nS1gqdn/KXPw8uFCQQhacFyL13kCbk6hF3CHrZD7ow+0KaSGciJWa X-Gm-Gg: ASbGncsps/mUbxzknac1Hzl18zqbU0YS0YZUJJ8mcwsyaUegkrZA7nl5ipuktM2FLOW cUPk8/AfDJs+eroRO1g9OLpZDMht5bRxwICXLS7OEQ0FfJ80pbQaQ77EMXZHlGZTEdaJs3xPIyW kLqIQcwSK6nJQ5/ZlirCM4DBK9b13QEknd2dzZ1yxVg7CzfjOQdBoAefRs1uuuBR4peUQUbH7nK UdXJIH2OgQo7MSYDdFb+MelkbJk5MIrHJl1k5DkZdwMg7gPUfr44oSJKOcp2q3fKTYNz75rk5oY SuvjaQQ20UX6GkSCZLezcqkALztPr4vhwQ9fRkLJjchG2b1OmEpIoDArprlS5AOVYe8tpyPhScD FsR5LzAQ1K9U0a6vuA3NELExGAYhoFilukUYwwbic4N78dRm6H6526r6OqatusBOpQpmONQ/7qO 2YpXh3uV3Hx1lV6TMTkx+9SOJUqkQoN6z40Q== X-Google-Smtp-Source: AGHT+IEclS6G6EcJV+FyLo0enuKKbOcLt+n1cgnAEiaiCVM4oKPCfoPpC87F8eFlRuMFk0ymkdhgfA== X-Received: by 2002:a17:902:fc4c:b0:295:f95d:30f0 with SMTP id d9443c01a7336-2962adb2693mr60369825ad.50.1762369377082; Wed, 05 Nov 2025 11:02:57 -0800 (PST) Received: from localhost ([2804:14d:328a:a59c:508c:4e61:157a:d34d]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29650967e11sm2957185ad.8.2025.11.05.11.02.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 05 Nov 2025 11:02:56 -0800 (PST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 05 Nov 2025 16:02:52 -0300 Message-Id: Cc: "Joel Jacobson" , "Tom Lane" , "pgsql-hackers" Subject: Re: LISTEN/NOTIFY bug: VACUUM sets frozenxid past a xid in async queue From: "Matheus Alcantara" To: "Heikki Linnakangas" , "Matheus Alcantara" , "Arseniy Mukhin" X-Mailer: aerc 0.21.0 References: <149c402d-54c9-48dd-a730-2f5b958f2129@app.fastmail.com> <769bbdba-f86f-44ad-abad-f6ea4f74e3f2@iki.fi> <2297af80-dd5d-4fcc-815b-75bd64b00bf9@app.fastmail.com> <2759499.1761756503@sss.pgh.pa.us> <6ae4acd3-6c57-4271-bc24-634fd1b11d67@iki.fi> <68079c62-2fe9-4489-b68d-3b1b911ebd59@app.fastmail.com> <66213fee-00ff-4952-802d-c06454e521ac@iki.fi> In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed Nov 5, 2025 at 9:59 AM -03, Heikki Linnakangas wrote: >> In case of an error on TransactionIdDidCommit() I think that we will >> have the same behavior as we advance the "current" position before of >> DidCommit call the PG_FINALLY block will set the backend position past >> the failing notification entry. > > With my patch, if TransactionIdDidCommit() fails, we will lose all the=20 > notifications that we have buffered in the local buffer but haven't=20 > passed to NotifyMyFrontEnd() yet. On 'master', you only lose a single=20 > notification, the one where TransactionIdDidCommit() failed. > Yeah, that's true. >> How bad would be to store the notification entries within a list and >> store the next position with the notification entry and then wrap the >> NotifyMyFrontEnd() call within a PG_TRY and update the "current" to the >> saved "next position" on PG_CATCH? Something like this: > > [ ...] > > That addresses the failure on NotifyMyFrontEnd, but not on=20 > TransactionIdDidCommit. > > IMHO we should just make these errors FATAL. TransactionIdDidCommit()=20 > should not really fail, after fixing the bug we're discussing.=20 > NotifyMyFrontEnd() could fail on OOM, but that seems pretty unlikely on= =20 > an otherwise idle connection. Or it could fail if the client connection= =20 > is lost, but then the backend is about to die anyway. And arguably=20 > closing the connection is better than losing even a single notification,= =20 > anyway. > My only concern with making these errors FATAL is that if a notification entry causes a different, recoverable error, all subsequent messages will be lost. This is because if backend die and the user open a new connection and execute LISTEN on the channel it will not see these notifications past the one that caused the error. I'm not sure if we are completely safe from this case of a recoverable error, what do you think? --=20 Matheus Alcantara EDB: http://www.enterprisedb.com