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 1w05Ho-001bQj-0f for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Mar 2026 22:10:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w05Hm-006Kj5-25 for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Mar 2026 22:10:43 +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 1w05Hm-006Kix-1D for pgsql-hackers@lists.postgresql.org; Tue, 10 Mar 2026 22:10:42 +0000 Received: from lahtoruutu.iki.fi ([2a0b:5c81:1c1::37]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w05Hk-000000022Ij-2ovu for pgsql-hackers@postgresql.org; Tue, 10 Mar 2026 22:10:42 +0000 Received: from [10.0.2.15] (unknown [130.41.208.2]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 4fVp3g3qDbz49Q4q; Wed, 11 Mar 2026 00:10:39 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1773180639; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9CcPSuKkNXMKk48UYDpRoIwKioVd2xE2hPMkIWl/FGM=; b=Jd+mjumhrF2wIqZn5ist6+MwSVoWhR0XxcB3LuO9IOK6oOkok3hn1hojPyUduaPhIOL6hb QzKHGbAmwsT3VutKwp9BCzFzYFazJEa5bApfxoraVXzCpbLD6Ct1qPIjgv3K0iqrASKw0m CEnHgt+r9i7ZG4GIzHP7AIQGZbPq1rhCz6Q9Ns0hZav5p58jRV08rys5q1PrMDFOARf0hY u7neLC6sRSuG6B4u24lHlNRopMi/LVcR4N4poaDRYXyc2ewoLg39RX0Y38rhLOP2AuuvNZ N9Ty0G09thdTJoLGhoBkLkeZQRfjfFFOKtvXhkoJ3HFRT8b3tVKOOZoaFl4czQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1773180639; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9CcPSuKkNXMKk48UYDpRoIwKioVd2xE2hPMkIWl/FGM=; b=OSWO0RPpcykHVi75UIAOHSgs5dyi7e1BsK788hnk4tNTZyyE0sdYuJfM1ylqVxY+KPI4l+ DHMtCyJiAs2jtZfyzaFWrlHI/54KAy+AUIBkbtMXhy8s2U461cRgVK3TeEK3gedH1sQs8G C10E2bSql8MB72pMNkDZQWG0nDSWTzF7QKVIQr9Z4jECzs/jQc1ZtCijrdRcdLfKVbJ8as lGkxf3x6PpLQHg6Zxbw60/Hfs26UR+RIeUxIVvlXy2a0r1eo4excMq8EguvdDSYISYhK7H UceBWP6PpZNI7HC9OcfaPj5LiIhjiCQjSLkjbejN4Bs3zmGq1Mn8hNLL4tVErQ== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi ARC-Seal: i=1; a=rsa-sha256; d=iki.fi; s=lahtoruutu; cv=none; t=1773180639; b=HaeXG0TnyoHEW4+wxrNsJyD45TRRnhmNOVq9Q1POaL2Q4eHJ373/D5xHMl9vGWMWw5r3iZ UCxlA7u0lVw9SqLsoYOpsE5eCjsDJORzru2C9TNqUSpB1uvKJVvmExMYWXHDpE0n+p2dLm u7U1xSfAItiTvlr5JgUqTNaA8Bg68tlX2qn7nAN7CtsMT/UFkY16j1D7swDthpt/0MIk2V c3JEBRYcE6VtLFIDva3aNMaWdnQ4kONhn8Y9F5X5/agL0IEHDlth1q388ulNwxF8oOhsM/ kpSEaKQIRb/rrDXMMf1ISF007wcDpVSOF+usqAuuVQJ3qvmf5K3mZAZygMBlUw== Message-ID: Date: Wed, 11 Mar 2026 00:10:38 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Refactor recovery conflict signaling a little To: Xuneng Zhou Cc: Alexander Lakhin , "pgsql-hackers@postgresql.org" , Chao Li References: <4cc13ba1-4248-4884-b6ba-4805349e7f39@iki.fi> <81b2c9a1-6d75-4ba9-894c-fd66c9036d99@iki.fi> <70774903-9f03-4816-b008-e2002a652bb9@iki.fi> <1f354762-c6a8-46a5-9626-efeb45f5f112@iki.fi> <25f20e5b-786e-42c2-9f0c-b253742ddbf5@gmail.com> <3e07149d-060b-48a0-8f94-3d5e4946ae45@gmail.com> <54f60f3f-3a77-4e99-b2d5-99c5e32e6a75@iki.fi> Content-Language: en-US From: Heikki Linnakangas In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10/03/2026 05:55, Xuneng Zhou wrote: > On Tue, Mar 10, 2026 at 1:05 AM Xuneng Zhou wrote: >> >> On Mon, Mar 9, 2026 at 11:28 PM Heikki Linnakangas wrote: >>> >>> On 09/03/2026 17:02, Xuneng Zhou wrote: >>>> Did you use Alexander’s reproducer script? I tried reproducing with a >>>> 1 ms pg_usleep() added to all three functions that clear >>>> MyProc->pendingRecoveryConflicts, but I still couldn’t reproduce the >>>> issue. >>> >>> I used the attached, to be precise. With that it fails every time for >>> me. I'm not sure if the "if (am_walsender)" check is necessary, I added >>> it just to make the test run faster. >>> >>> - Heikki >> >> I was able to reproduce the issue using a wider sleep window as you >> suggested and can confirm that the flag is not cleared after applying >> the patch. Below are two logs—one from a successful run and one from a >> failed run. I'll look further into the patch later on. >> >> failed run: >> startup[1418915] LOG: DBG SignalRecoveryConflict target_pid=1419118 >> reason=4 old_mask=0x0 new_mask=0x10 >> walsender[1419118] LOG: DBG ProcArrayEndTransaction(no-xid) CLEARING >> pendingRecoveryConflicts=0x10 >> >> successful run: >> startup[1433218] LOG: DBG SignalRecoveryConflict target_pid=1433406 >> reason=4 old_mask=0x0 new_mask=0x10 >> walsender[1433406] LOG: DBG ProcessInterrupts handler fired 1 >> time(s), pending=0x10 -- processing >> walsender[1433406] ERROR: canceling statement due to conflict with recovery > > I ran the script several times after applying the patch, and all tests > passed without deadlocking. LGTM. Ok, thanks for confirming! Pushed. > One nit: should we separate the comment fix and the > InitAuxiliaryProcess hardening into separate patches? I think it's appropriate to include them here; they're also follow-up fixes for the same commit 17f51ea818. - Heikki