BUG #17098: Assert failed on composing an error message when adding a type to an extension being dropped

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: exclusion(at)gmail(dot)com
Subject: BUG #17098: Assert failed on composing an error message when adding a type to an extension being dropped
Date: 2021-07-09 20:00:01
Message-ID: 17098-b960f3616c861f83@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

The following bug has been logged on the website:

Bug reference: 17098
Logged by: Alexander Lakhin
Email address: exclusion(at)gmail(dot)com
PostgreSQL version: 14beta2
Operating system: Ubuntu 20.04
Description:

When trying to add to an extension a type that is already exists in the
extension while the extension is being dropped I get a failed assertion with
the following stack:
Core was generated by `postgres: law regression [local] ALTER EXTENSION
'.
Program terminated with signal SIGABRT, Aborted.
#0 __GI_raise (sig=sig(at)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(at)entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007f59c4321859 in __GI_abort () at abort.c:79
#2 0x000055c3c74912e0 in ExceptionalCondition
(conditionName=conditionName(at)entry=0x55c3c76a024c "strvalue != NULL",
errorType=errorType(at)entry=0x55c3c74f000b "FailedAssertion",
fileName=0x7ffc8db80390 "\301\022I\307\303U",
fileName(at)entry=0x55c3c76a0241 "snprintf.c",
lineNumber=lineNumber(at)entry=442) at assert.c:69
#3 0x000055c3c74ee489 in dopr (target=target(at)entry=0x7ffc8db80970,
format=0x55c3c7521ee7 "\"",
format(at)entry=0x55c3c7521ec0 "%s is already a member of extension
\"%s\"", args=0x7ffc8db80a20) at snprintf.c:442
#4 0x000055c3c74eeb5c in pg_vsnprintf (str=<optimized out>,
count=<optimized out>, count(at)entry=1024,
fmt=fmt(at)entry=0x55c3c7521ec0 "%s is already a member of extension
\"%s\"", args=args(at)entry=0x7ffc8db80a20)
at snprintf.c:195
#5 0x000055c3c74e4e33 in pvsnprintf (buf=<optimized out>,
len=len(at)entry=1024,
fmt=fmt(at)entry=0x55c3c7521ec0 "%s is already a member of extension
\"%s\"", args=args(at)entry=0x7ffc8db80a20)
at psprintf.c:110
#6 0x000055c3c74e6221 in appendStringInfoVA (str=str(at)entry=0x7ffc8db80a00,

fmt=fmt(at)entry=0x55c3c7521ec0 "%s is already a member of extension
\"%s\"", args=args(at)entry=0x7ffc8db80a20)
at stringinfo.c:149
#7 0x000055c3c7495fbe in errmsg (fmt=fmt(at)entry=0x55c3c7521ec0 "%s is
already a member of extension \"%s\"")
at elog.c:919
#8 0x000055c3c7120cda in ExecAlterExtensionContentsStmt
(stmt=stmt(at)entry=0x55c3c7810f60,
objAddr=objAddr(at)entry=0x7ffc8db80c14) at extension.c:3342
#9 0x000055c3c7357837 in ProcessUtilitySlow
(pstate=pstate(at)entry=0x55c3c7831d60, pstmt=pstmt(at)entry=0x55c3c7811270,
queryString=queryString(at)entry=0x55c3c7810450 "ALTER EXTENSION cube ADD
TYPE side;",
context=context(at)entry=PROCESS_UTILITY_TOPLEVEL, params=params(at)entry=0x0,
queryEnv=queryEnv(at)entry=0x0,
dest=0x55c3c7811340, qc=0x7ffc8db81130) at utility.c:1550
#10 0x000055c3c7356b48 in standard_ProcessUtility (pstmt=0x55c3c7811270,
queryString=0x55c3c7810450 "ALTER EXTENSION cube ADD TYPE side;",
readOnlyTree=<optimized out>,
context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0,
dest=0x55c3c7811340, qc=0x7ffc8db81130)
at utility.c:1049
#11 0x000055c3c7356c31 in ProcessUtility (pstmt=pstmt(at)entry=0x55c3c7811270,
queryString=<optimized out>,
readOnlyTree=<optimized out>,
context=context(at)entry=PROCESS_UTILITY_TOPLEVEL, params=<optimized out>,
queryEnv=<optimized out>, dest=0x55c3c7811340, qc=0x7ffc8db81130) at
utility.c:527
#12 0x000055c3c7354157 in PortalRunUtility
(portal=portal(at)entry=0x55c3c78725b0, pstmt=pstmt(at)entry=0x55c3c7811270,
isTopLevel=isTopLevel(at)entry=true,
setHoldSnapshot=setHoldSnapshot(at)entry=false, dest=dest(at)entry=0x55c3c7811340,

qc=qc(at)entry=0x7ffc8db81130) at pquery.c:1147
#13 0x000055c3c7354459 in PortalRunMulti
(portal=portal(at)entry=0x55c3c78725b0, isTopLevel=isTopLevel(at)entry=true,
setHoldSnapshot=setHoldSnapshot(at)entry=false,
dest=dest(at)entry=0x55c3c7811340, altdest=altdest(at)entry=0x55c3c7811340,
qc=qc(at)entry=0x7ffc8db81130) at pquery.c:1304
#14 0x000055c3c735488d in PortalRun (portal=portal(at)entry=0x55c3c78725b0,
count=count(at)entry=9223372036854775807,
isTopLevel=isTopLevel(at)entry=true, run_once=run_once(at)entry=true,
dest=dest(at)entry=0x55c3c7811340,
altdest=altdest(at)entry=0x55c3c7811340, qc=0x7ffc8db81130) at
pquery.c:786
#15 0x000055c3c7350ada in exec_simple_query (
query_string=query_string(at)entry=0x55c3c7810450 "ALTER EXTENSION cube ADD
TYPE side;") at postgres.c:1214
#16 0x000055c3c7352aac in PostgresMain (argc=argc(at)entry=1,
argv=argv(at)entry=0x7ffc8db81320, dbname=<optimized out>,
username=<optimized out>) at postgres.c:4486
#17 0x000055c3c72ada9c in BackendRun (port=port(at)entry=0x55c3c7831220) at
postmaster.c:4507
#18 0x000055c3c72b0cb1 in BackendStartup (port=port(at)entry=0x55c3c7831220) at
postmaster.c:4229
#19 0x000055c3c72b0ef8 in ServerLoop () at postmaster.c:1745
#20 0x000055c3c72b2445 in PostmasterMain (argc=3, argv=<optimized out>) at
postmaster.c:1417
#21 0x000055c3c71f309e in main (argc=3, argv=0x55c3c780a4c0) at main.c:209

Reproduced with the following script:
echo "
CREATE EXTENSION cube;
DROP EXTENSION cube;
" >/tmp/ce.sql

echo "
CREATE TYPE side AS ENUM('front');
ALTER EXTENSION cube ADD TYPE side;
" >/tmp/ae.sql

for n in `seq 10`; do
echo "iteration $n"
( { for f in `seq 1000`; do cat /tmp/ce.sql; done } | psql ) >psql-1.log
2>&1 &
( { for f in `seq 1000`; do cat /tmp/ae.sql; done } | psql ) >psql-2.log
2>&1 &
wait
coredumpctl --no-pager && break
done

Reproduced on REL_12_STABLE..master. The assert was added by 6d842be6c, so
on REL_11_STABLE I see just:
ERROR: type side is already a member of extension "(null)"

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Japin Li 2021-07-10 02:31:34 Re: Statistics updates is delayed when using `commit and chain`
Previous Message Tom Lane 2021-07-09 17:39:58 Re: BUG #17097: FailedAssertion at initsplan.c

Browse pgsql-hackers by date

  From Date Subject
Next Message Ibrar Ahmed 2021-07-09 20:00:20 Re: Online verification of checksums
Previous Message Ibrar Ahmed 2021-07-09 19:37:57 Re: standby recovery fails (tablespace related) (tentative patch and discussion)