Re: segfault due to invalid cached plan - Mailing list pgsql-hackers

From Nicolas Thauvin
Subject Re: segfault due to invalid cached plan
Date
Msg-id 20180328165448.74cc5287@dalibo.com
Whole thread Raw
In response to Re: segfault due to invalid cached plan  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
List pgsql-hackers
On Wed, 28 Mar 2018 16:14:04 +0200
Tomas Vondra <tomas.vondra@2ndquadrant.com> wrote:

> On 03/28/2018 03:54 PM, Nicolas Thauvin wrote:
> > Hello,
> > 
> > A customer sent us a core dump of the crash of the background
> > worker of the powa extension, running on 9.6.8 along side with
> > cstore_fdw.
> > 
> > The background worker loops on a plpgsql function, which then
> > execute another plpgsql function that issues the query "TRUNCATE
> > powa_statements_history_current".
> > 
> > Here is the backtrace :
> > 
> > ...
> >
> > The core shows that ProcessUtility hook of cstore_fdw produces a
> > segfault when trying to copy the relation list of the truncate
> > statement plan.
> > 
> > In frame 2:
> > (gdb) p *((TruncateStmt *)parseTree)
> > $26 = {type = T_TruncateStmt, relations = 0x2f106a8, restart_seqs =
> > 0 '\000', behavior = DROP_RESTRICT} (gdb) p *(((TruncateStmt
> > *)parseTree)->relations) $27 = {type = 49574520, length = 0, head =
> > 0x0, tail = 0x2faaab8}
> > 
> > With this invalid list, standard_ProcessUtility would not have
> > failed but the relation would not have been truncated.
> > 
> > ...
> > 
> > Could you please give me some pointers to further investigate this
> > crash?
> >   
> 
> Sounds like a bug in CStoreProcessUtility, which is part of
> cstore_fdw, not PostgreSQL. So I guess the right place to report the
> issue is
> 
>    https://github.com/citusdata/cstore_fdw
> 
> 

Having a second look at the code of cstore_fdw, it modifies the data.
I'll investigate more on this code.

Thank you
-- 
Nicolas Thauvin
+33 (0)1 84 16 92 09
http://dalibo.com - http://dalibo.org


pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: [HACKERS] PATCH: multivariate histograms and MCV lists
Next
From: Anastasia Lubennikova
Date:
Subject: Re: WIP: Covering + unique indexes.