pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matthijs van der Vleuten <postgresql@zr40.nl>
To: Peter Geoghegan <pg@bowt.ie>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19082: Failing assert in index scan
Date: Fri, 10 Oct 2025 19:09:01 +0200
Message-ID: <08a4226e-9886-439e-b745-3d65defd078e@app.fastmail.com> (raw)
In-Reply-To: <CAH2-Wzk4gMoxF_wpD3J9YeyjRWHr=GvruiJFkwRoZ_L0q4+_=g@mail.gmail.com>
References: <19082-628e62160dbbc1c1@postgresql.org>
	<CAH2-WzmbZevxTOZdtqz2JL7THZGVCG0uEfv5-J-p2ZrpJOe8xA@mail.gmail.com>
	<2cab08f7-be3d-44f7-a7d1-8ba3d358118c@app.fastmail.com>
	<CAH2-Wzk4gMoxF_wpD3J9YeyjRWHr=GvruiJFkwRoZ_L0q4+_=g@mail.gmail.com>

On Fri, Oct 10, 2025, at 18:28, Peter Geoghegan wrote:
> On Fri, Oct 10, 2025 at 12:13 PM Matthijs van der Vleuten
> <postgresql@zr40.nl> wrote:
>> No, none of the tables and indexes in that database are unlogged or temporary.
>
> 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 different table but it fails the assertion the same way.

zr40@[local]:5432 mastodon_production=# explain SELECT "preview_cards_statuses".* FROM "preview_cards_statuses" WHERE "preview_cards_statuses"."status_id" = 114337794133378371 LIMIT 1;
                                                   QUERY PLAN                                                    
-----------------------------------------------------------------------------------------------------------------
 Limit  (cost=0.42..2.84 rows=1 width=81)
   ->  Index Scan using preview_cards_statuses_pkey on preview_cards_statuses  (cost=0.42..2.84 rows=1 width=81)
         Index Cond: (status_id = '114337794133378371'::bigint)
(3 rows)

zr40@[local]:5432 mastodon_production=# select "preview_cards_statuses".* FROM "preview_cards_statuses" WHERE "preview_cards_statuses"."status_id" = 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: "./build/../src/backend/access/nbtree/nbtutils.c", Line: 1782, PID: 50833
postgres: zr40 mastodon_production [local] SELECT(ExceptionalCondition+0x75) [0x5654f247eea5]
postgres: zr40 mastodon_production [local] SELECT(_bt_killitems+0x550) [0x5654f1ff4710]
postgres: zr40 mastodon_production [local] SELECT(+0x1eee95) [0x5654f1febe95]
postgres: zr40 mastodon_production [local] SELECT(_bt_next+0x92) [0x5654f1fed472]
postgres: zr40 mastodon_production [local] SELECT(btgettuple+0x7c) [0x5654f1fe9ddc]
postgres: zr40 mastodon_production [local] SELECT(index_getnext_tid+0x56) [0x5654f1fdab06]
postgres: zr40 mastodon_production [local] SELECT(index_getnext_slot+0x7b) [0x5654f1fdad4b]
postgres: zr40 mastodon_production [local] SELECT(+0x37bfbd) [0x5654f2178fbd]
postgres: zr40 mastodon_production [local] SELECT(+0x37e3e9) [0x5654f217b3e9]
postgres: zr40 mastodon_production [local] SELECT(standard_ExecutorRun+0x19b) [0x5654f215013b]
postgres: zr40 mastodon_production [local] SELECT(+0x531141) [0x5654f232e141]
postgres: zr40 mastodon_production [local] SELECT(PortalRun+0x2b0) [0x5654f232fa10]
postgres: zr40 mastodon_production [local] SELECT(+0x52e651) [0x5654f232b651]
postgres: zr40 mastodon_production [local] SELECT(PostgresMain+0x1618) [0x5654f232d088]
postgres: zr40 mastodon_production [local] SELECT(+0x49036b) [0x5654f228d36b]
postgres: zr40 mastodon_production [local] SELECT(PostmasterMain+0xeee) [0x5654f228e50e]
postgres: zr40 mastodon_production [local] SELECT(main+0x21c) [0x5654f1f6806c]
/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) [0x5654f1f68631]
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 running: select "preview_cards_statuses".* FROM "preview_cards_statuses" WHERE "preview_cards_statuses"."status_id" = 114337794133378371 LIMIT 1;
2025-10-10 19:03:26 CEST 68e8cff4.6ce1 | LOG:  terminating any other active server processes





view thread (8+ messages)  latest in thread

Message-ID: <08a4226e-9886-439e-b745-3d65defd078e@app.fastmail.com>
Permalink:  ../08a4226e-9886-439e-b745-3d65defd078e@app.fastmail.com/
Also on:    postgresql.org/message-id/08a4226e-9886-439e-b745-3d65defd078e@app.fastmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: postgresql@zr40.nl, pg@bowt.ie, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #19082: Failing assert in index scan
  In-Reply-To: <08a4226e-9886-439e-b745-3d65defd078e@app.fastmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox