Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Justin Pryzby <pryzby@telsasoft.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Thomas Munro <thomas.munro@gmail.com>
Date: 2022-05-31T19:57:14Z
Lists: pgsql-hackers
On Thu, May 19, 2022 at 11:00 PM Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote: > 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.. Yeah, so when I created this stuff in the first place, I figured that it wasn't a problem if we reserved relptr == 0 to mean a NULL pointer, because you would never have a relative pointer pointing to the beginning of a DSM, because it would probably always start with a dsm_toc. But when Thomas made it so that DSM allocations could happen in the main shared memory segment, that ceased to be true. This example happened not to break because we never use relptr_access() on fpm->self. We do use fpm_segment_base(), but that accidentally fails to break, because instead of using relptr_access() it drills right through the abstraction and doesn't have any kind of special case for 0. So we can fix this by: 1. Using a relative pointer value other than 0 to represent a null pointer. Andres suggested (Size) -1. 2. Not storing the free page manager for the DSM in the main shared memory segment at byte offset 0. 3. Dropping the assertion while loudly singing "la la la la la la". -- Robert Haas EDB: http://www.enterprisedb.com
Commits
-
Fix relptr's encoding of the base address.
- 99504ff8265e 14.5 landed
- 7201cd18627a 15.0 landed
-
Suppress compiler warning in relptr_store().
- e07d4ddc55fd 15.0 cited