From: Noah Misch <noah@leadboat.com>
To: adamguo@amazon.com
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18912: TRAP: failed Assert("tag.spcOid != GLOBALTABLESPACE_OID"), File: "bufmgr.c", Line: 4165, PID: 2115
Date: Mon, 5 May 2025 17:31:01 -0700
Message-ID: <20250506003101.51.nmisch@google.com> (raw)
In-Reply-To: <18912-a41c9bd0e0ad19b1@postgresql.org>
References: <18912-a41c9bd0e0ad19b1@postgresql.org>
On Mon, May 05, 2025 at 10:01:15PM +0000, PG Bug reporting form wrote:
> ```
> CREATE USER myuser;
> REINDEX SCHEMA pg_catalog;
> SET SESSION AUTHORIZATION myuser;
> GRANT ALTER SYSTEM ON PARAMETER log_filename TO myuser;
> GRANT ALTER SYSTEM ON PARAMETER log_filename TO myuser WITH GRANT OPTION;
> ```
> From what I can tell, all of these statements are necessary to reproduce the
> error. On the last one, the backend aborts at buffer/bufmgr.c:4165 [1].
> This
> assert was introduced in f4ece891 [2]. Seems like something is holding onto
> an
> LW_EXCLUSIVE lock on a system catalog?
> According to gdb, the relation in question is not a system catalog but does
> live
> in the pg_global tablespace. I can't find it in pg_class.
> ```
> (gdb) up 3
> #3 0x00000000009e1f48 in AssertNotCatalogBufferLock (lock=0x7f8ab5782c30,
> mode=LW_EXCLUSIVE,
> unused_context=0x0) at bufmgr.c:4165
> 4165 Assert(tag.spcOid != GLOBALTABLESPACE_OID);
> (gdb) p tag.spcOid
> $1 = 1664
> (gdb) p relid
> $2 = 16526
> ```
Thanks for the report. On my system, it's pg_parameter_acl_parname_index:
[local] test=*# select pg_filenode_relation(1664, '16529');
pg_filenode_relation
────────────────────────────────
pg_parameter_acl_parname_index
(1 row)
That's an IsCatalogTextUniqueIndexOid() index, but the REINDEX makes
AssertNotCatalogBufferLock() unable to detect it as one. Hence, I think I'll
be removing the assert you reached:
--- a/src/backend/storage/buffer/bufmgr.c+++ b/src/backend/storage/buffer/bufmgr.c@@ -4160,10 +4160,8 @@ AssertNotCatalogBufferLock(LWLock *lock, LWLockMode mode,
if (IsCatalogTextUniqueIndexOid(relid)) /* see comments at the callee */
return;
Assert(!IsCatalogRelationOid(relid));
- /* Shared rels are always catalogs: detect even after VACUUM FULL. */- Assert(tag.spcOid != GLOBALTABLESPACE_OID);
}
It's true that shared rels are always catalogs. However, without a way to
judge IsCatalogTextUniqueIndexOid(), we can't assert-fail.
> [1]
> https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/storage/buffer/bufmgr.c;hb=...
> [2]
> https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=f4ece891fc2f
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noah@leadboat.com, adamguo@amazon.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18912: TRAP: failed Assert("tag.spcOid != GLOBALTABLESPACE_OID"), File: "bufmgr.c", Line: 4165, PID: 2115
In-Reply-To: <20250506003101.51.nmisch@google.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox