Re: BUG #14668: BRIN open autosummarize=on , database will crash

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: digoal(at)126(dot)com
Cc: PostgreSQL Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14668: BRIN open autosummarize=on , database will crash
Date: 2017-05-24 10:47:30
Message-ID: CAEepm=3LqJUjaHOb_CeH+KuNUhmNhxztd+Sn6DN5PhPdDK_JTQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, May 24, 2017 at 6:33 PM, <digoal(at)126(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Haas 2017-05-24 10:57:08 Re: [HACKERS] Concurrent ALTER SEQUENCE RESTART Regression
Previous Message digoal 2017-05-24 06:33:23 BUG #14668: BRIN open autosummarize=on , database will crash