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

Alvaro Herrera <alvherre@2ndquadrant.com>

From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: digoal@126.com, PostgreSQL Bugs <pgsql-bugs@postgresql.org>
Date: 2017-05-30T22:19:55Z
Lists: pgsql-bugs
Thomas Munro wrote:

> 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.

Pushed fix.  Actually that's not correct either, because tuples returned
by brinGetTupleForHeapBlock are not supposed to be freed at all since
they are shared buffer items.  The correct thing to do there was to
release the buffer lock ...

Thanks for the report and analysis.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Commits

  1. brin: Don't crash on auto-summarization