Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ifvFR-0000yL-Vi for pgsql-bugs@arkaria.postgresql.org; Sat, 14 Dec 2019 00:25:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ifvFQ-0003Sw-J6 for pgsql-bugs@arkaria.postgresql.org; Sat, 14 Dec 2019 00:25:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ifvFO-0003SZ-Dv; Sat, 14 Dec 2019 00:25:28 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ifvFG-00010W-UZ; Sat, 14 Dec 2019 00:25:25 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 03EB6C1F; Fri, 13 Dec 2019 19:25:15 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 13 Dec 2019 19:25:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:content-transfer-encoding:in-reply-to; s=fm3; bh=z tS+BgIxKoVzesINB6LPvm+Cni/21kAaqc6IP0c5bPc=; b=FmiK0UhvXvy43W7Fe S1xZaoPu7wW9a4/aBY8h/OIVol5hgD5oIVsC43KSghgQoQQHkMUfdlMM5bSUMY2S hAm1y/NhnXhvAbtZTqaTvrdDqsSQ+iBpNMTtMzwoRt+766fyzTA2ICt2iNBbzZxe 2Vv+WSBFKrrsM9OpJ0DeTq8nN1EYUs7968njdDu3YkG/juGvE12E2AGu0Ui+60qd a/xHN9eSA4A7UbVg4VceyxD53KD/bRHUPW97U/q37fTCImYiU7iZmq6fUxvYR6HC AABySDNe3mGqLgUq12U2wD6fLYVUpxvCQf4Qo0FHxJQZvb+DiRIP4Lhcux8yTu+4 CrYxg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=ztS+BgIxKoVzesINB6LPvm+Cni/21kAaqc6IP0c5b Pc=; b=AOoiS2auomBhV5Rq2bOsm8vZyYIhMeEO7f7/F70IfPKsJd/3wg1JjwBgw ntDyDlSPHIGjfgU39crEYhJ7p/AHby5jC2mHkX179HloiQKvbYoB3eOTGzdApQjD cZW8doLHOMU+VmUvNZ9yvOStIqOnu2Jo9ZwI+BixzNeKGYdSQ7H5oyKf7CTbYu/U OfrYf6BgN0s1HGw7epfH2lHcLmXvDQ1DyU2vDlnKTJ7zQxXVpYa/Cn3+RCsy7MT2 V/VyORmGCoRU45JYwNIkRF6tbQ/7YiIoKyhgO/apBwIqDb8mJ/qtVX0DxazWG/BW 34c+22RAU9Tl5krD0yXfv6xql0tbw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvddttddgvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtugfgjgesthekredttddtudenucfhrhhomheptehnughr vghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuffhomh grihhnpehpohhsthhgrhgvshhqlhdrohhrghenucfkphepieejrdduiedtrddvudekrddv feejnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrnhgurhgvshesrghnrghrrgiivghlrd guvgenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from intern.anarazel.de (c-67-160-218-237.hsd1.ca.comcast.net [67.160.218.237]) by mail.messagingengine.com (Postfix) with ESMTPA id CBB9180062; Fri, 13 Dec 2019 19:25:14 -0500 (EST) Date: Fri, 13 Dec 2019 16:25:13 -0800 From: Andres Freund To: Jeremy Schneider Cc: "Drouvot, Bertrand" , Tomas Vondra , "pgsql-bugs@postgresql.org" , PostgreSQL-development Subject: Re: logical decoding bug: segfault in ReorderBufferToastReplace() Message-ID: <20191214002513.p5rw6vqenzvrud5y@alap3.anarazel.de> References: <20191205133836.lulisfo2fphdrjp3@development> <20191211163522.t2ljtydarlmusoix@alap3.anarazel.de> <81182626-e836-061f-8f19-204edac18922@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <81182626-e836-061f-8f19-204edac18922@amazon.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2019-12-13 16:13:35 -0800, Jeremy Schneider wrote: > On 12/11/19 08:35, Andres Freund wrote: > > I think we need to see pg_waldump output for the preceding records. That > > might allow us to see why there's a toast record that's being associated > > with this table, despite there not being a toast table. > Unfortunately the WAL logs are no longer available at this time.  :( > > I did a little poking around in the core file and searching source code > but didn't find anything yet.  Is there any memory structure that would > have the preceding/following records cached in memory?  If so then I > might be able to extract this from the core dumps. Well, not the records directly, but the changes could be, depending on the size of the changes. That'd already help. It depends a bit on whether there are subtransactions or not (txn->nsubtxns will tell you). Within one transaction, the currently loaded (i.e. not changes that are spilled to disk, and haven't currently been restored - see txn->serialized) changes are in ReorderBufferTXN->changes. > > Seems like we clearly should add an elog(ERROR) here, so we error out, > > rather than crash. > done - in the commit that I replied to when I started this thread :) > > https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=69f883fef14a3fc5849126799278abcc43f40f56 Ah, I was actually thinking this is the thread of a similar sounding bug, where ReorderBufferToastReplace would crash because there isn't actually a new tuple - there somehow toast changes exist for a delete. > > Is this version of postgres effectively unmodified in any potentially > > relevant region (snapshot computations, generation of WAL records, ...)? > It's not changed from community code in any relevant regions.  (Also, > FYI, this is not Aurora.) Well, I've heard mutterings that plain RDS postgres had some efficiency improvements around snapshots (in the GetSnapshotData() sense) - and that's an area where slightly wrong changes could quite plausibly cause a bug like this. Greetings, Andres Freund