BUG #16134: Assertion fails on CREATE gist INDEX over intarray

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 #16134: Assertion fails on CREATE gist INDEX over intarray
Date: 2019-11-24 07:33:34
Message-ID: 16134-0423f729671dec64@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 16134
Logged by: Alexander Lakhin
Email address: exclusion(at)gmail(dot)com
PostgreSQL version: 12.1
Operating system: Ubuntu 18.04
Description:

When running the following script (repeated to improve reproducing):
echo "
CREATE EXTENSION IF NOT EXISTS intarray;
DROP TABLE IF EXISTS test__int;
CREATE TABLE test__int( a int[] );
\copy test__int from 'contrib/intarray/data/test__int.data'
INSERT INTO test__int SELECT * FROM test__int;
INSERT INTO test__int SELECT * FROM test__int;
INSERT INTO test__int SELECT * FROM test__int;
INSERT INTO test__int SELECT * FROM test__int;
CREATE INDEX test_idx on test__int using gist ( a gist__int_ops );
" >/tmp/test_gist_intarray.sql

for i in `seq 1 10`; do
echo "iteration $i"
psql -f /tmp/test_gist_intarray.sql || break
done

Server (compiled with cassert) crashes:
...
iteration 3
psql:/tmp/test_gist_intarray.sql:2: NOTICE: extension "intarray" already
exists, skipping
CREATE EXTENSION
DROP TABLE
CREATE TABLE
COPY 7000
INSERT 0 7000
INSERT 0 14000
INSERT 0 28000
INSERT 0 56000
psql:/tmp/test_gist_intarray.sql:10: server closed the connection
unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
psql:/tmp/test_gist_intarray.sql:10: fatal: connection to server was lost
...

Core was generated by `postgres: law regression [local] CREATE INDEX
'.
Program terminated with signal SIGABRT, Aborted.
#0 __GI_raise (sig=sig(at)entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../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:51
#1 0x00007fc7965ad801 in __GI_abort () at abort.c:79
#2 0x000055eed7d77022 in ExceptionalCondition (
conditionName=conditionName(at)entry=0x55eed7de3c28 "!(((((ItemId)
(&((PageHeader) (page))->pd_linp[(todelete) - 1])))->lp_len != 0))",
errorType=errorType(at)entry=0x55eed7dce108 "FailedAssertion",
fileName=fileName(at)entry=0x55eed7de3bd0 "gistutil.c",
lineNumber=lineNumber(at)entry=70) at assert.c:54
#3 0x000055eed7913d48 in gistnospace (page=page(at)entry=0x7fc78e534d00 "",
itvec=itvec(at)entry=0x7ffca5b65df0,
len=len(at)entry=2, todelete=todelete(at)entry=18,
freespace=freespace(at)entry=819) at gistutil.c:70
#4 0x000055eed7911291 in gistplacetopage (rel=0x7fc7976df500,
freespace=819,
giststate=giststate(at)entry=0x55eed9038ab0, buffer=1859,
itup=itup(at)entry=0x7ffca5b65df0, ntup=ntup(at)entry=2,
oldoffnum=18, newblkno=0x0, leftchildbuf=1014, splitinfo=0x7ffca5b65d80,
markfollowright=true,
heapRel=0x7fc7976e97a0, is_build=true) at gist.c:257
#5 0x000055eed79126a1 in gistinserttuples
(state=state(at)entry=0x7ffca5b66130, stack=0x7ffca5b66100,
giststate=giststate(at)entry=0x55eed9038ab0,
tuples=tuples(at)entry=0x7ffca5b65df0, ntup=ntup(at)entry=2,
oldoffnum=<optimized out>, leftchild=1014, rightchild=1011,
unlockbuf=true, unlockleftchild=true) at gist.c:1269
#6 0x000055eed79128df in gistfinishsplit (state=state(at)entry=0x7ffca5b66130,
stack=stack(at)entry=0x55eed9038a18,
giststate=giststate(at)entry=0x55eed9038ab0, splitinfo=<optimized out>,
unlockbuf=unlockbuf(at)entry=true) at gist.c:1377
#7 0x000055eed791276b in gistinserttuples
(state=state(at)entry=0x7ffca5b66130, stack=0x55eed9038a18,
giststate=giststate(at)entry=0x55eed9038ab0,
tuples=tuples(at)entry=0x7ffca5b65ee0, ntup=ntup(at)entry=2,
oldoffnum=<optimized out>, leftchild=1028, rightchild=1012,
unlockbuf=true, unlockleftchild=true) at gist.c:1296
#8 0x000055eed79128df in gistfinishsplit (state=state(at)entry=0x7ffca5b66130,
stack=stack(at)entry=0x55eed902f258,
giststate=giststate(at)entry=0x55eed9038ab0, splitinfo=<optimized out>,
unlockbuf=unlockbuf(at)entry=true) at gist.c:1377
#9 0x000055eed791276b in gistinserttuples
(state=state(at)entry=0x7ffca5b66130, stack=0x55eed902f258,
giststate=giststate(at)entry=0x55eed9038ab0,
tuples=tuples(at)entry=0x7ffca5b65fd0, ntup=ntup(at)entry=2,
oldoffnum=<optimized out>, leftchild=1016, rightchild=1013,
unlockbuf=true, unlockleftchild=false) at gist.c:1296
#10 0x000055eed79128df in gistfinishsplit (state=state(at)entry=0x7ffca5b66130,
stack=stack(at)entry=0x55eed9030c50,
giststate=giststate(at)entry=0x55eed9038ab0, splitinfo=<optimized out>,
unlockbuf=unlockbuf(at)entry=false)
at gist.c:1377
#11 0x000055eed791276b in gistinserttuples
(state=state(at)entry=0x7ffca5b66130, stack=stack(at)entry=0x55eed9030c50,
giststate=giststate(at)entry=0x55eed9038ab0,
tuples=tuples(at)entry=0x7ffca5b660c8, ntup=ntup(at)entry=1,
oldoffnum=oldoffnum(at)entry=12, leftchild=0, rightchild=0,
unlockbuf=false, unlockleftchild=false) at gist.c:1296
#12 0x000055eed7912c2c in gistinserttuple (state=state(at)entry=0x7ffca5b66130,
stack=stack(at)entry=0x55eed9030c50,
giststate=giststate(at)entry=0x55eed9038ab0, tuple=<optimized out>,
tuple(at)entry=0x55eed90326b8,
oldoffnum=oldoffnum(at)entry=12) at gist.c:1222
#13 0x000055eed791322b in gistdoinsert (r=r(at)entry=0x7fc7976df500,
itup=itup(at)entry=0x55eed9036c08,
freespace=<optimized out>, giststate=0x55eed9038ab0, heapRel=<optimized
out>, is_build=is_build(at)entry=true)
at gist.c:789
#14 0x000055eed792161b in gistBuildCallback
(index=index(at)entry=0x7fc7976df500, htup=htup(at)entry=0x55eed8f84d50,
values=values(at)entry=0x7ffca5b66280, isnull=isnull(at)entry=0x7ffca5b66260,
tupleIsAlive=tupleIsAlive(at)entry=true,
---Type <return> to continue, or q <return> to quit---
state=state(at)entry=0x7ffca5b66640) at gistbuild.c:489
#15 0x000055eed794748b in heapam_index_build_range_scan
(heapRelation=0x7fc7976e97a0, indexRelation=0x7fc7976df500,
indexInfo=0x55eed9029ef0, allow_sync=<optimized out>, anyvisible=false,
progress=true, start_blockno=0,
numblocks=4294967295, callback=0x55eed79215b0 <gistBuildCallback>,
callback_state=0x7ffca5b66640,
scan=0x55eed8f84d00) at heapam_handler.c:1664
#16 0x000055eed7921886 in table_index_build_scan (scan=0x0,
callback_state=0x7ffca5b66640,
callback=0x55eed79215b0 <gistBuildCallback>, progress=true,
allow_sync=true, index_info=0x55eed9029ef0,
index_rel=0x7fc7976df500, table_rel=0x7fc7976e97a0) at
../../../../src/include/access/tableam.h:1508
#17 gistbuild (heap=0x7fc7976e97a0, index=0x7fc7976df500,
indexInfo=0x55eed9029ef0) at gistbuild.c:196
#18 0x000055eed79c4eba in index_build
(heapRelation=heapRelation(at)entry=0x7fc7976e97a0,
indexRelation=indexRelation(at)entry=0x7fc7976df500,
indexInfo=indexInfo(at)entry=0x55eed9029ef0,
isreindex=isreindex(at)entry=false, parallel=parallel(at)entry=true) at
index.c:2844
#19 0x000055eed79c6716 in index_create
(heapRelation=heapRelation(at)entry=0x7fc7976e97a0,
indexRelationName=indexRelationName(at)entry=0x55eed9029c68 "test_idx",
indexRelationId=16523,
indexRelationId(at)entry=0, parentIndexRelid=parentIndexRelid(at)entry=0,
parentConstraintId=parentConstraintId(at)entry=0,
relFileNode=0, indexInfo=0x55eed9029ef0, indexColNames=0x55eed8f84c70,
accessMethodObjectId=783, tableSpaceId=0,
collationObjectId=0x55eed8f851d0, classObjectId=0x55eed8f851f0,
coloptions=0x55eed8f85210, reloptions=0, flags=0,
constr_flags=0, allow_system_table_mods=false, is_internal=false,
constraintId=0x7ffca5b669b0) at index.c:1222
#20 0x000055eed7a71376 in DefineIndex (relationId=relationId(at)entry=16517,
stmt=stmt(at)entry=0x55eed9029bd0,
indexRelationId=indexRelationId(at)entry=0,
parentIndexId=parentIndexId(at)entry=0,
parentConstraintId=parentConstraintId(at)entry=0,
is_alter_table=is_alter_table(at)entry=false, check_rights=true,
check_not_in_use=true, skip_build=false, quiet=false) at
indexcmds.c:986
#21 0x000055eed7c542b9 in ProcessUtilitySlow
(pstate=pstate(at)entry=0x55eed9029ab8, pstmt=pstmt(at)entry=0x55eed8f5e680,
queryString=queryString(at)entry=0x55eed8f5d618 "CREATE INDEX test_idx on
test__int using gist ( a gist__int_ops );",
context=context(at)entry=PROCESS_UTILITY_TOPLEVEL, params=params(at)entry=0x0,
queryEnv=queryEnv(at)entry=0x0,
dest=0x55eed8f5e778, completionTag=0x7ffca5b66fa0 "") at
utility.c:1372
#22 0x000055eed7c53869 in standard_ProcessUtility (pstmt=0x55eed8f5e680,
queryString=0x55eed8f5d618 "CREATE INDEX test_idx on test__int using
gist ( a gist__int_ops );",
context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0,
dest=0x55eed8f5e778, completionTag=0x7ffca5b66fa0 "")
at utility.c:927
#23 0x000055eed7c53917 in ProcessUtility (pstmt=pstmt(at)entry=0x55eed8f5e680,
queryString=<optimized out>,
context=context(at)entry=PROCESS_UTILITY_TOPLEVEL, params=<optimized out>,
queryEnv=<optimized out>,
dest=dest(at)entry=0x55eed8f5e778, completionTag=0x7ffca5b66fa0 "") at
utility.c:360
#24 0x000055eed7c4fdbe in PortalRunUtility
(portal=portal(at)entry=0x55eed8fc46d8, pstmt=pstmt(at)entry=0x55eed8f5e680,
isTopLevel=isTopLevel(at)entry=true,
setHoldSnapshot=setHoldSnapshot(at)entry=false, dest=dest(at)entry=0x55eed8f5e778,

completionTag=completionTag(at)entry=0x7ffca5b66fa0 "") at pquery.c:1175
#25 0x000055eed7c50a0d in PortalRunMulti
(portal=portal(at)entry=0x55eed8fc46d8, isTopLevel=isTopLevel(at)entry=true,
setHoldSnapshot=setHoldSnapshot(at)entry=false,
dest=dest(at)entry=0x55eed8f5e778, altdest=altdest(at)entry=0x55eed8f5e778,
completionTag=completionTag(at)entry=0x7ffca5b66fa0 "") at pquery.c:1321
---Type <return> to continue, or q <return> to quit---
#26 0x000055eed7c5177d in PortalRun (portal=portal(at)entry=0x55eed8fc46d8,
count=count(at)entry=9223372036854775807,
isTopLevel=isTopLevel(at)entry=true, run_once=run_once(at)entry=true,
dest=dest(at)entry=0x55eed8f5e778,
altdest=altdest(at)entry=0x55eed8f5e778, completionTag=0x7ffca5b66fa0 "")
at pquery.c:796
#27 0x000055eed7c4da2d in exec_simple_query (
query_string=query_string(at)entry=0x55eed8f5d618 "CREATE INDEX test_idx on
test__int using gist ( a gist__int_ops );") at postgres.c:1215
#28 0x000055eed7c4f9fd in PostgresMain (argc=<optimized out>,
argv=argv(at)entry=0x55eed8f88870, dbname=<optimized out>,
username=<optimized out>) at postgres.c:4236
#29 0x000055eed7bc1e2d in BackendRun (port=port(at)entry=0x55eed8f7ef90) at
postmaster.c:4437
#30 0x000055eed7bc50f3 in BackendStartup (port=port(at)entry=0x55eed8f7ef90) at
postmaster.c:4128
#31 0x000055eed7bc540a in ServerLoop () at postmaster.c:1704
#32 0x000055eed7bc67fb in PostmasterMain (argc=3, argv=<optimized out>) at
postmaster.c:1377
#33 0x000055eed7b21d87 in main (argc=3, argv=0x55eed8f579f0) at main.c:228

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Petr Fedorov 2019-11-24 14:10:33 Precision/scale of a numeric attribute of a new data type are not handled correctly when the type is returned by a function
Previous Message Sandeep Thakkar 2019-11-23 11:18:48 Re: BUG #16117: Server cannot be installed