Assertion failure in _bt_pagedel (leafblkno == scanblkno) after interrupted VACUUM

Поиск
Список
Период
Сортировка
Искать

Assertion failure in _bt_pagedel (leafblkno == scanblkno) after interrupted VACUUM

От:
Iliia Khaprov <i.khaprov@gmail.com>
Дата:
Вложения:
Hello,

We were doing some fuzzing with an oss-fuzz derivative
(github.com/stroppy-io/pg-fuzz). The usual crashes are ubsan-only
integer shifts. Yesterday it was a new thing - a cassert
in half-dead page processing (originally found on 17.10):

  TRAP: failed Assert("leafblkno == scanblkno"), File: "nbtpage.c", Line: 1949

Note, unlike a similar report from 2024 on the same line, this one does
not need any concurrency.

A sweep was done across REL_16 to REL_19 and master heads:
    master                     5bd2e236e21b  nbtpage.c:1959
    REL_19_STABLE   bb356f869fa5     nbtpage.c:1979
    REL_18_STABLE   ccffd34399f5      nbtpage.c:1949
    REL_17_STABLE   0165f38d11ec    nbtpage.c:1949
    REL_16_STABLE   6f2f510845c5     nbtpage.c:1954

Stack trace, reproducer SQL and matrix summary attached. Reproduced on
master and REL_19 with the nbtree-leave-page-half-dead injection point.
The reproducer needs VACUUM (INDEX_CLEANUP ON).

I of course LLMed this and have a patch. LMK if it is of any interest.
Hope it was helpful,
Iliia

Re: Assertion failure in _bt_pagedel (leafblkno == scanblkno) after interrupted VACUUM

От:
shihao zhong <zhong950419@gmail.com>
Дата:
Hi Iliia,

Thanks, I can reproduce this on master with your script.

_bt_pagedel() builds no descent stack when the page it is given is
already half-dead. If the right sibling of that page is empty too, it
steps right and builds the stack there. The assertion insisted that this
only happens for the initial page. That stopped being true once an
interrupted VACUUM could leave the initial page half-dead. 

Feels like the right way is to remove the assertion.

Thanks,
Shihao

Re: Assertion failure in _bt_pagedel (leafblkno == scanblkno) after interrupted VACUUM

От:
Iliia Khaprov <i.khaprov@gmail.com>
Дата:
Thank you Shihao,

I will submit a patch.

Best regards,
Iliia

On Wed, Sep 30, 2026 at 7:00 AM shihao zhong <zhong950419@gmail.com> wrote:
Hi Iliia,

Thanks, I can reproduce this on master with your script.

_bt_pagedel() builds no descent stack when the page it is given is
already half-dead. If the right sibling of that page is empty too, it
steps right and builds the stack there. The assertion insisted that this
only happens for the initial page. That stopped being true once an
interrupted VACUUM could leave the initial page half-dead. 

Feels like the right way is to remove the assertion.

Thanks,
Shihao

Re: Assertion failure in _bt_pagedel (leafblkno == scanblkno) after interrupted VACUUM

От:
Peter Geoghegan <pg@bowt.ie>
Дата:
On Mon, Sep 28, 2026 at 3:31 PM Iliia Khaprov  wrote:
> We were doing some fuzzing with an oss-fuzz derivative
> (github.com/stroppy-io/pg-fuzz). The usual crashes are ubsan-only
> integer shifts. Yesterday it was a new thing - a cassert
> in half-dead page processing (originally found on 17.10):
>
>   TRAP: failed Assert("leafblkno == scanblkno"), File: "nbtpage.c", Line: 1949

I pushed a fix for this just now.

Thanks for the report.

-- 
Peter Geoghegan


FAQ