Re: Pg 15 devel crashes when fetching data from table using cursor

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: hubert depesz lubaczewski <depesz(at)depesz(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Pg 15 devel crashes when fetching data from table using cursor
Date: 2022-03-11 01:38:10
Message-ID: CAH2-WzkHD5VDnswg_1qTQ45zqxQCAkkPwmmvL_8EX3Gut+mSbw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Mar 10, 2022 at 4:50 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
> On 2022-03-07 10:44:23 +0100, hubert depesz lubaczewski wrote:
> > TRAP: FailedAssertion("HaveRegisteredOrActiveSnapshot()", File: "toast_internals.c", Line: 670, PID: 526595)

> That's a new assertion, but I put it in to detect bugs like what's fixed in
> 7c38ef2a5d6cf6d8dc3834399d7a1c364d64ce64. Looks like something in the snapshot
> mangement of cursors is busted...
>
> Any chance you could try to come up with a reproducer?

Although it isn't related to this bug, I thought I'd still ask: where
else we could add "Assert(HaveRegisteredOrActiveSnapshot())" like
this, to get similar protection? Isn't this exactly the kind of
assertion that is contemplated by comments in GlobalVisTestFor() that
you wrote (for the snapshot scalability work)?

Right now GlobalVisTestFor() only uses a weaker assertion:

GlobalVisState *
GlobalVisTestFor(Relation rel)
{
GlobalVisState *state = NULL;

/* XXX: we should assert that a snapshot is pushed or registered */
Assert(RecentXmin);
....
}

I tried adding a similar assertion here myself just now, but that
breaks heap_page_prune_opt() (opportunistic pruning) that takes place
in the autovacuum launcher. I doubt that that means very much, though.

--
Peter Geoghegan

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2022-03-11 01:50:30 Re: Pg 15 devel crashes when fetching data from table using cursor
Previous Message Andres Freund 2022-03-11 00:50:45 Re: Pg 15 devel crashes when fetching data from table using cursor