Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uC6DL-00APob-JA for pgsql-bugs@arkaria.postgresql.org; Tue, 06 May 2025 00:31:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uC6DG-006BUF-TG for pgsql-bugs@arkaria.postgresql.org; Tue, 06 May 2025 00:31:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uC6DG-006BU6-Bj for pgsql-bugs@lists.postgresql.org; Tue, 06 May 2025 00:31:10 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uC6DA-000LKI-10 for pgsql-bugs@lists.postgresql.org; Tue, 06 May 2025 00:31:09 +0000 Received: by mail-pj1-x102a.google.com with SMTP id 98e67ed59e1d1-308702998fbso4627681a91.1 for ; Mon, 05 May 2025 17:31:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1746491464; x=1747096264; darn=lists.postgresql.org; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:to :from:date:from:to:cc:subject:date:message-id:reply-to; bh=1Wjb0RDfcf88gEX+BiCrzw/4FS3NyXJ87p0FxbpC3q4=; b=gFI5pHbn/liIu996Q86rQCc4RNYug/XUxmRlUGCqEUfi0/UJkeB4TQQHQ2hoXIKdIe MOGeM9A/l57y9cOvhADHnhgF6zqe/tgxHTxiCaaoXCLdnhnNhDveGBKNysWE2Nu1GhtP 6Dd3MaGrospXi++Hh952n7Mqv6Oa+s7mm8lvY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746491464; x=1747096264; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:to :from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1Wjb0RDfcf88gEX+BiCrzw/4FS3NyXJ87p0FxbpC3q4=; b=FyhEIhGS3TfkaXJgu1vtwB2J8kH1Wmnv0L/PcudgcGEpPudBNn7eUzxwN9Fr2jLHor oQa/8bdRvVQzV67TyR81K6bdGNCEaUX7AvaLGIzrXKRpW+vVHlGyYn2NiGMSmKF87eM5 riGlYKXvxboZ+YzdSqHIqjF/XMvFVazJMS9BDXlpH1M43e/VixboP0bwGwPHxaTVBJxk 96OS/n6HqxhxbfvUnHWY/CcAqP/u1odWepi8y4KEGJf214u0SBb5TF/yxcThgUlVcW6D VgGWJ07DA2vf6wes4O7/K/VNhJd3B2TYVymmNTZjsiFAAB2Yvk1PGqG9XI+GrCxE+CP/ bn0w== X-Forwarded-Encrypted: i=1; AJvYcCXtUIrgwoxx8O0djmBmLcaA+NpmI+7o29B4+uNbJU/YH6MPth6wuOOhQXqwog6capwoAaICWGGlIwIY@lists.postgresql.org X-Gm-Message-State: AOJu0Yyoso8gGGSPC7j3Zi/fnkaB2gcw5enpUXIjaAAIGM3MfcBjqBEJ YQLBbsjYfZgxeFx7nvz5L26exRz7vfb8rISpu5GzSeB1JrZnkubIcIQG5r3lsg== X-Gm-Gg: ASbGncsXMkqcMYmdSamkVldRQdWhATv29l87kTSA/0jz2zk5KFyeVRiOXJTlspML/Rr w3G/6eIGMWIWC+cLod44sm7oWTltuBysCX9gYLM0LOtn6HaeZaEWW/jT5wNZu0xwkJ3yyTchmZ0 puZdvv6GkPs0kH+qtJswQk46nuleoGFXYsgC6P/PB8P5kaytgugF1+Y7LwXjBHtqaVPoJnDD4Ro BSBZhPCu83AmjUGKATC/dUFMmPptjzbveTVfLupRHBphrTuGI9ke90ZnogMRyqa6PO26ykagdEW bwbkM9tten+KMXAm59RJeWSWb/IKvtuY6HsCiQ== X-Google-Smtp-Source: AGHT+IFsAfMuuMaPxb1Dd+HZP4RQH1MXIicQl4f99E+jyblhjMn1A9+j7wxtGvVlkyVZ+25u4PnpPQ== X-Received: by 2002:a17:90b:1ccd:b0:304:ec28:4437 with SMTP id 98e67ed59e1d1-30a61a3871cmr11257603a91.22.1746491463890; Mon, 05 May 2025 17:31:03 -0700 (PDT) Received: from google.com ([2601:647:5600:80d0::31cd]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-30a34778329sm12418826a91.28.2025.05.05.17.31.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 May 2025 17:31:03 -0700 (PDT) Date: Mon, 5 May 2025 17:31:01 -0700 From: Noah Misch To: 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 Message-ID: <20250506003101.51.nmisch@google.com> References: <18912-a41c9bd0e0ad19b1@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <18912-a41c9bd0e0ad19b1@postgresql.org> User-Agent: Mutt/2.2.12 (2023-09-09) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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=HEAD#l4165 > [2] > https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=f4ece891fc2f