Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m8pjs-0007QK-Tp for pgsql-bugs@arkaria.postgresql.org; Wed, 28 Jul 2021 20:01:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m8pjr-0000bE-6a for pgsql-bugs@arkaria.postgresql.org; Wed, 28 Jul 2021 20:01:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m8pjq-0000b6-Vn for pgsql-bugs@lists.postgresql.org; Wed, 28 Jul 2021 20:01:10 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m8pjm-0001JS-7q for pgsql-bugs@lists.postgresql.org; Wed, 28 Jul 2021 20:01:10 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 844625C00C6; Wed, 28 Jul 2021 16:01:05 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 28 Jul 2021 16:01:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=ZayBYJ8fPsCjAgbxuDqUCiFufiIasxSt7aq5mljR73w=; b=S/KdNAxA gJgCrh70zE1QgjD/DrbK/kmAG+14s7Sv6NR23qZWh50J636UuXxlwjKoy8HQqQ/f 9VpniNfVyMj4o13aEv02Do8j2mt0OwFe7fJO0QhVLJ2Xbf5Uigp6+tqXgnQFGk69 mMlfcxIuUmN+KDPcMQUzUYK56Dh8ev8FAP+S5FyRvvwQMuzFmEGHquop0U7Ij1A1 TrxCR/YnNyG+IwZi55pUthsi1uSCK0EG2pZC48unLPzejbswpTtdF7LBpjeB8p3Q BxjfPxv/8CrTXjevYOyZ1uMurjd/R7mJFG+qfPcSc6hasCBkekybsjZaeyl9HIW0 ecWOzxuSVEVPbA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrgeelgdduudduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkgggtugfgjgesmhekre ertddtjeenucfhrhhomheptehlvhgrrhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgv segrlhhvhhdrnhhoqdhiphdrohhrgheqnecuggftrfgrthhtvghrnheptedvhfetueeuke efhfefudegfffhhefhvdelffelteekgeegfefhgfegkeejtddunecuffhomhgrihhnpegv nhhtvghrphhrihhsvggusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrh grmhepmhgrihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 28 Jul 2021 16:01:04 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 0A4B32A067A; Wed, 28 Jul 2021 16:01:01 -0400 (-04) Date: Wed, 28 Jul 2021 16:01:01 -0400 From: Alvaro Herrera To: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17126: Server crashes on dropping user while enumerating owned objects that are droppped concurrently Message-ID: <202107282001.rfd75lew2c33@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="vjhvxrxktll7m7of" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <17126-21887f04508cb5c8@postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --vjhvxrxktll7m7of Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On 2021-Jul-28, PG Bug reporting form wrote: > Dropping a user that owns a number of procedures, while some of them are > being dropped, can cause the server crash: > > Core was generated by `postgres: law regression [local] DROP ROLE > '. > Program terminated with signal SIGABRT, Aborted. > #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 > 50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. > (gdb) bt > #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 > #1 0x00007f268882b859 in __GI_abort () at abort.c:79 > #2 0x000055a23a628276 in ExceptionalCondition (conditionName=conditionName@entry=0x55a23a77fd4d "pointer != NULL", > errorType=errorType@entry=0x55a23a68700b "FailedAssertion", fileName=0x7ffdf4459470 "W\202b:\242U", > fileName@entry=0x55a23a7886b0 "../../../../src/include/utils/memutils.h", lineNumber=lineNumber@entry=123) > at assert.c:69 > #3 0x000055a23a65b46e in GetMemoryChunkContext (pointer=0x0) at ../../../../src/include/utils/memutils.h:123 > #4 pfree (pointer=pointer@entry=0x0) at mcxt.c:1171 > #5 0x000055a23a23254f in storeObjectDescription (descs=descs@entry=0x7ffdf44598b0, type=LOCAL_OBJECT, > object=object@entry=0x55a23b5efe10, deptype=SHARED_DEPENDENCY_OWNER, count=count@entry=0) at pg_shdepend.c:1267 There's many places that deal correctly with the possibility that getObjectDescription() would return NULL, but I found two places that don't. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ --vjhvxrxktll7m7of Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="null-objdesc.patch" diff --git a/src/backend/catalog/dependency.c b/src/backend/catalog/dependency.c index 76b65e39c4..d9a00aab85 100644 --- a/src/backend/catalog/dependency.c +++ b/src/backend/catalog/dependency.c @@ -1092,6 +1092,10 @@ reportDependentObjects(const ObjectAddresses *targetObjects, objDesc = getObjectDescription(obj, false); + /* An object being dropped concurrently doesn't need to be reported */ + if (objDesc == NULL) + continue; + /* * If, at any stage of the recursive search, we reached the object via * an AUTO, INTERNAL, PARTITION, or EXTENSION dependency, then it's diff --git a/src/backend/catalog/pg_shdepend.c b/src/backend/catalog/pg_shdepend.c index 4b676f5607..e9bf16af3e 100644 --- a/src/backend/catalog/pg_shdepend.c +++ b/src/backend/catalog/pg_shdepend.c @@ -1231,6 +1231,12 @@ storeObjectDescription(StringInfo descs, { char *objdesc = getObjectDescription(object, false); + /* + * An object being dropped concurrently doesn't need to be reported. + */ + if (objdesc == NULL) + return; + /* separate entries with a newline */ if (descs->len != 0) appendStringInfoChar(descs, '\n'); --vjhvxrxktll7m7of--