BUG #18912: TRAP: failed Assert("tag.spcOid != GLOBALTABLESPACE_OID"), File: "bufmgr.c", Line: 4165, PID: 2115 - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #18912: TRAP: failed Assert("tag.spcOid != GLOBALTABLESPACE_OID"), File: "bufmgr.c", Line: 4165, PID: 2115
Date
Msg-id 18912-a41c9bd0e0ad19b1@postgresql.org
Whole thread Raw
Responses Re: BUG #18912: TRAP: failed Assert("tag.spcOid != GLOBALTABLESPACE_OID"), File: "bufmgr.c", Line: 4165, PID: 2115
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      18912
Logged by:          Adam Guo
Email address:      adamguo@amazon.com
PostgreSQL version: Unsupported/Unknown
Operating system:   Amazon Linux 2
Description:

Hi team,
I noticed an assert failure in PG18beta1.  I can reproduce it by running the
following:
```
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
```
Regards,
Adam Guo
[1]
https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/storage/buffer/bufmgr.c;hb=HEAD#l4165
[2]
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=f4ece891fc2f


pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: BUG #18911: Bug in the command INHERITS.
Next
From: Noah Misch
Date:
Subject: Re: BUG #18912: TRAP: failed Assert("tag.spcOid != GLOBALTABLESPACE_OID"), File: "bufmgr.c", Line: 4165, PID: 2115