On Wed, May 24, 2017 at 6:33 PM, <digoal@126.com> wrote:
> postgres=# create table test(id serial8, c1 int, c2 int);
> CREATE TABLE
> postgres=# create index idx_test_1 on test using brin(id) with
> (pages_per_range=1,autosummarize=on);
> CREATE INDEX
>
> vi test.sql
> \set c1 random(1,10000)
> \set c2 random(1,1000000)
> insert into test (c1,c2) values (:c1, :c2);
>
> pgbench -M prepared -n -r -P 1 -f ./test.sql -c 32 -j 32 -T 100
> ```
>
> then PostgreSQL crash,
Reproduced here.
frame #3: 0x000000010ac2d6f0
postgres`ExceptionalCondition(conditionName="!(pointer !=
((void*)0))", errorType="FailedAssertion",
fileName="../../../../src/include/utils/memutils.h", lineNumber=116) +
128 at assert.c:54 frame #4: 0x000000010ac6f856
postgres`GetMemoryChunkContext(pointer=0x0000000000000000) + 54 at
memutils.h:116 frame #5: 0x000000010ac6f725
postgres`pfree(pointer=0x0000000000000000) + 21 at mcxt.c:952 frame #6: 0x000000010a5cabd5
postgres`brin_free_tuple(tuple=0x0000000000000000) + 21 at
brin_tuple.c:310 frame #7: 0x000000010a5c2b88
postgres`brininsert(idxRel=0x000000010b190638,
values=0x00007fff5563dbd0, nulls="", heaptid=0x00007fcb67801b8c,
heapRel=0x000000010b18b1d0, checkUnique=UNIQUE_CHECK_NO,
indexInfo=0x00007fcb67800aa0) + 680 at brin.c:193
I guess brin_free_tuple(lastPageTuple) should only be called if it's
not NULL, so I guess brin.c lacks an "else" here:
- brin_free_tuple(lastPageTuple);
+ else
+ brin_free_tuple(lastPageTuple);
It doesn't crash for me with that change.
--
Thomas Munro
http://www.enterprisedb.com
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs