From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: exclusion@gmail.com
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17126: Server crashes on dropping user while enumerating owned objects that are droppped concurrently
Date: Wed, 28 Jul 2021 16:01:01 -0400
Message-ID: <202107282001.rfd75lew2c33@alvherre.pgsql> (raw)
In-Reply-To: <17126-21887f04508cb5c8@postgresql.org>
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/Attachments:
[text/x-diff] null-objdesc.patch (1.1K, ../202107282001.rfd75lew2c33@alvherre.pgsql/2-null-objdesc.patch)
download | inline diff:diff --git a/src/backend/catalog/dependency.c b/src/backend/catalog/dependency.cindex 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.cindex 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');
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: alvherre@alvh.no-ip.org, 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
In-Reply-To: <202107282001.rfd75lew2c33@alvherre.pgsql>
* 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