Re: Pg 15 devel crashes when fetching data from table using cursor - Mailing list pgsql-bugs

From Peter Geoghegan
Subject Re: Pg 15 devel crashes when fetching data from table using cursor
Date
Msg-id CAH2-WzkHD5VDnswg_1qTQ45zqxQCAkkPwmmvL_8EX3Gut+mSbw@mail.gmail.com
Whole thread Raw
In response to Re: Pg 15 devel crashes when fetching data from table using cursor  (Andres Freund <andres@anarazel.de>)
Responses Re: Pg 15 devel crashes when fetching data from table using cursor  (Andres Freund <andres@anarazel.de>)
List pgsql-bugs
On Thu, Mar 10, 2022 at 4:50 PM Andres Freund <andres@anarazel.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



pgsql-bugs by date:

Previous
From: Andres Freund
Date:
Subject: Re: Pg 15 devel crashes when fetching data from table using cursor
Next
From: Andres Freund
Date:
Subject: Re: Pg 15 devel crashes when fetching data from table using cursor