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 1v7GdT-0005DB-C4 for pgsql-bugs@arkaria.postgresql.org; Fri, 10 Oct 2025 17:10:31 +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 1v7GcS-00DJGb-7i for pgsql-bugs@arkaria.postgresql.org; Fri, 10 Oct 2025 17:09:29 +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 1v7GcR-00DJGT-PX for pgsql-bugs@lists.postgresql.org; Fri, 10 Oct 2025 17:09:28 +0000 Received: from fhigh-a2-smtp.messagingengine.com ([103.168.172.153]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1v7GcQ-001RyT-05 for pgsql-bugs@lists.postgresql.org; Fri, 10 Oct 2025 17:09:28 +0000 Received: from phl-compute-09.internal (phl-compute-09.internal [10.202.2.49]) by mailfhigh.phl.internal (Postfix) with ESMTP id BEDB11400104; Fri, 10 Oct 2025 13:09:22 -0400 (EDT) Received: from phl-imap-08 ([10.202.2.84]) by phl-compute-09.internal (MEProxy); Fri, 10 Oct 2025 13:09:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zr40.nl; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1760116162; x=1760202562; bh=QrDul78xAdx2mnK6u53/fyUS/jUVHMT6OqmSA+aoB+k=; b= vkLsSvW1Zz4Wnyq1Ev8rlP+zbi7dPiP6ZM9YtkTvSt1DSB2mJ0WDzgPHE6mJWD/g lXWHeFiobeGW9bGLmvT11KexwwxpArci7t2shHB3+iI85vQHUIf+ZS1BIUSwLQgn cjuqgBGODokOdeNCyT3wJWQOQbzyqmsAhXUwstnb/koowYhZglfAlytvQXkNFHlg fnakjuS1OdAXzPFGC6Y+HT2XnwqgsVou9xp647AvoEd5rnOuWIuKfPKQOiSkUp7x fjPnkrmhSENNp/QAVPZvy1uQ0yEQERdjHCw9GPHAQWD4u0OZfZkWgqDCBUMqmfcg 5B14pMaUdKZplTbnlXYxMg== 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 :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1760116162; x= 1760202562; bh=QrDul78xAdx2mnK6u53/fyUS/jUVHMT6OqmSA+aoB+k=; b=B YEupe3SdxBwBrMJ0GVmFor0Mp48Lt3GA3eTZ4hZJ4QObz/ovdSxllsszqgmYV+Gb FT0IayLiUUz22QpaxnTafNQLJPY7vmL+j1OCDbJpWF4+OcI/TfshyHopmryyocSN pbBFwoGx64uul3I4MmH+MONnPBAFZRwkTCQVS69PUTNYCbuG7FzIjsGB5cV5ErZH zgQAo3mAcbmta/b0Z9jOa1Y+Zsw15Oqk8oJjmzNS8n7e7dErXBno9VnQLxtqZKaT 4zjF7MdxcpCJx3YGin8S/GhapAtvwxEHo9MQUvILifAXYSn3yzKwAMkli48mb3gz ng3AJw+tAOyEf0eAj6Pqw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddutdelieefucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvfevkfgjfhfutgfgsehtqhertdertdejnecuhfhrohhmpedfofgrthht hhhijhhsuchvrghnucguvghrucgglhgvuhhtvghnfdcuoehpohhsthhgrhgvshhqlhesii hrgedtrdhnlheqnecuggftrfgrthhtvghrnhepkeehjeejtedvvdduueejveekueeugefg gfelgeevveehffeugeeufeevffeuveejnecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomhepphhoshhtghhrvghsqhhlseiirhegtddrnhhlpdhnsggp rhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehpghessghofi htrdhivgdprhgtphhtthhopehpghhsqhhlqdgsuhhgsheslhhishhtshdrphhoshhtghhr vghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ifaa14279:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id CA99A2CE0067; Fri, 10 Oct 2025 13:09:21 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 X-ThreadId: AhyrMtzZzuFN Date: Fri, 10 Oct 2025 19:09:01 +0200 From: "Matthijs van der Vleuten" To: "Peter Geoghegan" Cc: pgsql-bugs@lists.postgresql.org Message-Id: <08a4226e-9886-439e-b745-3d65defd078e@app.fastmail.com> In-Reply-To: References: <19082-628e62160dbbc1c1@postgresql.org> <2cab08f7-be3d-44f7-a7d1-8ba3d358118c@app.fastmail.com> Subject: Re: BUG #19082: Failing assert in index scan Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Oct 10, 2025, at 18:28, Peter Geoghegan wrote: > On Fri, Oct 10, 2025 at 12:13=E2=80=AFPM Matthijs van der Vleuten > wrote: >> No, none of the tables and indexes in that database are unlogged or t= emporary. > > Are these backwards scans? In other words, does EXPLAIN show "Index > Scan Backwards" for these queries? I see that the first query "ORDER > BY "mentions"."id" ASC", but perhaps that index column is declared as > DESC (in which case it'd be a backwards scan)? No, the index columns aren't declared as DESC, and, as far as I've been = able to verify, the query plan doesn't use backward scans. I've isolated one particular row that triggers this assert. It's a diffe= rent table but it fails the assertion the same way. zr40@[local]:5432 mastodon_production=3D# explain SELECT "preview_cards_= statuses".* FROM "preview_cards_statuses" WHERE "preview_cards_statuses"= ."status_id" =3D 114337794133378371 LIMIT 1; QUERY PLAN = =20 ------------------------------------------------------------------------= ----------------------------------------- Limit (cost=3D0.42..2.84 rows=3D1 width=3D81) -> Index Scan using preview_cards_statuses_pkey on preview_cards_sta= tuses (cost=3D0.42..2.84 rows=3D1 width=3D81) Index Cond: (status_id =3D '114337794133378371'::bigint) (3 rows) zr40@[local]:5432 mastodon_production=3D# select "preview_cards_statuses= ".* FROM "preview_cards_statuses" WHERE "preview_cards_statuses"."status= _id" =3D 114337794133378371 LIMIT 1; server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: Failed. The connection to the server was lost. Attempting reset: Failed. Server logs: TRAP: failed Assert("!XLogRecPtrIsInvalid(so->currPos.lsn)"), File: "./b= uild/../src/backend/access/nbtree/nbtutils.c", Line: 1782, PID: 50833 postgres: zr40 mastodon_production [local] SELECT(ExceptionalCondition+0= x75) [0x5654f247eea5] postgres: zr40 mastodon_production [local] SELECT(_bt_killitems+0x550) [= 0x5654f1ff4710] postgres: zr40 mastodon_production [local] SELECT(+0x1eee95) [0x5654f1fe= be95] postgres: zr40 mastodon_production [local] SELECT(_bt_next+0x92) [0x5654= f1fed472] postgres: zr40 mastodon_production [local] SELECT(btgettuple+0x7c) [0x56= 54f1fe9ddc] postgres: zr40 mastodon_production [local] SELECT(index_getnext_tid+0x56= ) [0x5654f1fdab06] postgres: zr40 mastodon_production [local] SELECT(index_getnext_slot+0x7= b) [0x5654f1fdad4b] postgres: zr40 mastodon_production [local] SELECT(+0x37bfbd) [0x5654f217= 8fbd] postgres: zr40 mastodon_production [local] SELECT(+0x37e3e9) [0x5654f217= b3e9] postgres: zr40 mastodon_production [local] SELECT(standard_ExecutorRun+0= x19b) [0x5654f215013b] postgres: zr40 mastodon_production [local] SELECT(+0x531141) [0x5654f232= e141] postgres: zr40 mastodon_production [local] SELECT(PortalRun+0x2b0) [0x56= 54f232fa10] postgres: zr40 mastodon_production [local] SELECT(+0x52e651) [0x5654f232= b651] postgres: zr40 mastodon_production [local] SELECT(PostgresMain+0x1618) [= 0x5654f232d088] postgres: zr40 mastodon_production [local] SELECT(+0x49036b) [0x5654f228= d36b] postgres: zr40 mastodon_production [local] SELECT(PostmasterMain+0xeee) = [0x5654f228e50e] postgres: zr40 mastodon_production [local] SELECT(main+0x21c) [0x5654f1f= 6806c] /lib/x86_64-linux-gnu/libc.so.6(+0x29ca8) [0x7f0b6922eca8] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x85) [0x7f0b6922ed65] postgres: zr40 mastodon_production [local] SELECT(_start+0x21) [0x5654f1= f68631] 2025-10-10 19:03:26 CEST 68e8cff4.6ce1 | LOG: server process (PID 50833= ) was terminated by signal 6: Aborted 2025-10-10 19:03:26 CEST 68e8cff4.6ce1 | DETAIL: Failed process was run= ning: select "preview_cards_statuses".* FROM "preview_cards_statuses" WH= ERE "preview_cards_statuses"."status_id" =3D 114337794133378371 LIMIT 1; 2025-10-10 19:03:26 CEST 68e8cff4.6ce1 | LOG: terminating any other act= ive server processes