Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us
Cc: pryzby(at)telsasoft(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org, thomas(dot)munro(at)gmail(dot)com
Subject: Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)
Date: 2022-05-31 05:05:45
Message-ID: 20220531.140545.591054801161032223.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Fri, 20 May 2022 12:00:14 +0900 (JST), Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> wrote in
> At Thu, 19 May 2022 17:16:03 -0400, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote in
> > Justin Pryzby <pryzby(at)telsasoft(dot)com> writes:
> > > ./tmp_install/usr/local/pgsql/bin/postgres -D ./src/test/regress/tmp_check/data -c min_dynamic_shared_memory=1MB
> > > TRAP: FailedAssertion("val > base", File: "../../../../src/include/utils/relptr.h", Line: 67, PID: 21912)
> >
> > Yeah, I see it too.
> >
> > > It looks like this may be pre-existing problem exposed by
> > > commit e07d4ddc55fdcf82082950b3eb0cd8f728284c9d
> >
> > Agreed. Here I see
> >
> > #5 FreePageManagerInitialize (fpm=fpm(at)entry=0x7f34b3ddd300,
> > base=base(at)entry=0x7f34b3ddd300 "") at freepage.c:187
> > #6 0x000000000082423e in dsm_shmem_init () at dsm.c:473
> >
> > so that where we do
> >
> > relptr_store(base, fpm->self, fpm);
> >
> > the "relative" pointer value would have to be zero, making the case
> > indistinguishable from a NULL pointer. We can either change the
> > caller so that these addresses aren't the same, or give up the
> > ability to store NULL in relptrs ... doesn't seem like a hard call.
> >
> > One interesting question I didn't look into is why it takes a nondefault
> > value of min_dynamic_shared_memory to expose this bug.
>
> The path is taken only when a valid value is given to the
> parameter. If we don't use preallocated dsm, it is initialized
> elsewhere. In those cases the first bytes of the base address (the
> second parameter of FreePageManagerInitialize) are used for
> dsa_segment_header so the relptr won't be zero (!= NULL).
>
> It can be silenced by wasting the first MAXALIGN bytes of
> dsm_main_space_begin..

Actually, that change doesn't result in wasting of usable memory size
since the change doesn't move the first effective page.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
allow-setting-min_dynamic_shared_memory.patch text/x-patch 1.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2022-05-31 05:39:51 Re: PG15 beta1 sort performance regression due to Generation context change
Previous Message Michael Paquier 2022-05-31 04:58:25 Re: convert libpq uri-regress tests to tap test