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 1qkByj-00DUjt-7S for pgsql-bugs@arkaria.postgresql.org; Sat, 23 Sep 2023 23:24:02 +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 1qkByh-002dE8-PT for pgsql-bugs@arkaria.postgresql.org; Sat, 23 Sep 2023 23:23:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qkByg-002d51-AA for pgsql-bugs@lists.postgresql.org; Sat, 23 Sep 2023 23:23:59 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qkByc-006H4D-Ui for pgsql-bugs@lists.postgresql.org; Sat, 23 Sep 2023 23:23:57 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 5845D320093C; Sat, 23 Sep 2023 19:23:51 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Sat, 23 Sep 2023 19:23:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1695511430; x=1695597830; bh=nt sdX2FKcoVxhUQ5miREIy26GsTHVNN7+S0vdXWkXFU=; b=sGohMX4PAIDN/KdA/h FJPzBVwnFNvdCyCefwuDvz5iuQipvog8oqGcWZr+aq5wNN4/BcdnSSSIlAHee6Pl 8+EUE2Hg0uKfcboWAvo++5nQ6wqkSBmohpPAQOaEl7Ym469gc0a2wfY8eoTd0EOe Z3RPOKLr1emPa1SObGjxRDfeqLsKHvZvrIhT/qZLGySoTxl3lMX4piGsJThdmiQJ jeD04IpnvMkVQYc6K45IY0poskLnPZpG/cXw2JIeenmgkqNAOCa7XK9ynt9vHBuz hETtMHfE7GtHdI6RisBrtwME1sxHEzOcvZ8TDl7+jLrNmf4ELaD7uZEUbFWb3A2o Z1hg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1695511430; x=1695597830; bh=ntsdX2FKcoVxh UQ5miREIy26GsTHVNN7+S0vdXWkXFU=; b=b9lb7dJpgzh9AG2B+QiKEWSEQZOpR IsFPNqcTMuACy2BMcndwcQx0AuECw6x+GomOC3VlW7MIg32HIoYGiIG9Xv6mIlXU 48dIrFkXEQGPHLvCXlHQk/G59wNlItWbnIn5XCNfbmul5gbHLwDDRCG/IliAfx8w LBPwhpFLEcnxmWb/rl2mwYs5AGBu0cusjOCoJdONky8/gYnerrujLZ6YeK6TGjku 2HBylwsLd9tVohkZoYgKs0z4VN0gNUyfvVG6oprgASMlhIu+ouikKWjdvQZ/kmv0 7OCJk6SEX9RMbKNBeMjHw0wZCp/ZM4lWZbEl6wfQfLj70/5xL24aUdlGg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudeluddgvdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 23 Sep 2023 19:23:47 -0400 (EDT) Date: Sun, 24 Sep 2023 08:23:43 +0900 From: Michael Paquier To: Thomas Munro Cc: Alexander Lakhin , Sergei Kornilov , Noah Misch , Tom Lane , Kyotaro Horiguchi , pgsql-bugs@lists.postgresql.org, Fujii Masao Subject: Re: BUG #17928: Standby fails to decode WAL on termination of primary Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="s78qGRLUwiaTeLCJ" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --s78qGRLUwiaTeLCJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Sep 24, 2023 at 09:48:42AM +1300, Thomas Munro wrote: > "grison" has a little more detail -- we see > pg_comp_crc32c_sb8(len=3D4294636456). I'm wondering how to reproduce > this, but among the questions that jump out I have: why was it ever OK > that we load record->xl_tot_len into total_len, perform header > validation, determine that total_len < len (=3D this record is all on > one page, no reassembly loop needed, so now we're in the single-page > branch), then call ReadPageInternal() again, then call > ValidXLogRecord() which internally loads record->xl_tot_len *again*? > ReadPageInternal() might have changed xl_tot_len, no? That seems to > be a possible pathway to reading past the end of the buffer in the CRC > check, no? >=20 > If that value didn't change underneath us, I think we'd need an > explanation for how we finished up in the single-page branch at > xlogreader.c:842 with a large xl_tot_len, which I'm not seeing yet, > though it might take more coffee. (Possibly supporting the re-read > theory is the fact that it's only happening on a few very slow > computers, though I have no idea why it would only happen on master > [so far at least].) Hmm, it looks pretty clear that this is a HEAD-only thing as the buildfarm shows and as you say, and my primary suspect here would be 71e4cc6b8ec6, I think. Any race condition underneath it would be easier to see on slower machines. So it's likely possible that this has messed up the page insertion logic. -- Michael --s78qGRLUwiaTeLCJ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmUPc38ACgkQnvQgOdby QH3DNA//Zy70GBoctvIfoHVIPb+LBTpNfk2w9QQWHEskvQAdU4JHgYGZQi2/ksdp qX1c1MZnadazw6sw9mUYMYG1wJmUGOgZt7f/QXhBHol8ay0jrwWhJeEG42b6/eFD NMLaIQIALYB6aurtUX3NDtTWPrhmWKLzcVhjK4CKb7zikD5X+7PhCDQGAsyok0ss 3ntllEnN6Zl5kXaDnM9Bsz5gnRHLDlDCgo7D3/6rXTcwumsmAXBKmKpeT+d8+Fxz ZsxPkR7swHl1hZWxo5MzbL1LtB3aqFAVC4UANlcEuaFmJSkLLQJYNE8WGN9ynjoi 5t1rScT4nxmG0b4pcKuo/ctXi3LlEDII8H3FGE/xPbzOOVyhcsnO6tjjy5VTaw6D 2VK4a3ikHFdxnsEp2EwSOPspUb/GeHrBhazCnN2jLG4pi+JzMdOllkPnc7FZga56 qPGHe+64ETDY6xOP9wXRuFh7LFr44L6D9VSqnDbALYMHch4dePvQqNq6acH7X45x 1ZktUkVBSBQ5xlP2aCjIFCEc88v+WO/gslSCZLwaURCQxtcnhmbFF7GQgDtuYVPI qC2JW7hNFF5eZ9ycdeYxU2vUhBPv4kTXs+EJC/iLx7sLGwi0Wex5gKMWuSbBJTne qYqoiztT+HzSae7DQKRENTdkggn0x+cRKmsuaXKuASNOWSf5QKM= =Jqfy -----END PGP SIGNATURE----- --s78qGRLUwiaTeLCJ--