pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: darthunix@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14641: Segfault on searching KNN using btree_gist
Date: Thu, 04 May 2017 10:36:02 -0400
Message-ID: <7893.1493908562@sss.pgh.pa.us> (raw)
In-Reply-To: <20170504072034.24366.57688@wrigleys.postgresql.org>
References: <20170504072034.24366.57688@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

darthunix@gmail.com writes:
> I face a segmentation fault in postgresql when searching KNN using
> multicolumn btree_gist index.

Reproduced here, will look.  Thanks for the report!

Program terminated with signal 11, Segmentation fault.
#0  0x0000000000881052 in GetMemoryChunkContext (pointer=0x14d46e8)
    at ../../../../src/include/utils/memutils.h:124
124             AssertArg(MemoryContextIsValid(context));
(gdb) bt
#0  0x0000000000881052 in GetMemoryChunkContext (pointer=0x14d46e8)
    at ../../../../src/include/utils/memutils.h:124
#1  pfree (pointer=0x14d46e8) at mcxt.c:952
#2  0x00000000004a0492 in getNextNearest (scan=0x14709e0, 
    dir=<value optimized out>) at gistget.c:547
#3  gistgettuple (scan=0x14709e0, dir=<value optimized out>) at gistget.c:656
#4  0x00000000004cee63 in index_getnext_tid (scan=0x14709e0, 
    direction=<value optimized out>) at indexam.c:541
#5  0x000000000062ffab in IndexOnlyNext (node=0x15abcd0)
    at nodeIndexonlyscan.c:116
#6  0x000000000061cc67 in ExecScanFetch (node=0x15abcd0, 
    accessMtd=0x62ff30 <IndexOnlyNext>, recheckMtd=0x62ff00 <IndexOnlyRecheck>)
    at execScan.c:95
#7  ExecScan (node=0x15abcd0, accessMtd=0x62ff30 <IndexOnlyNext>, 
    recheckMtd=0x62ff00 <IndexOnlyRecheck>) at execScan.c:162
#8  0x000000000061b858 in ExecProcNode (node=0x15abcd0) at execProcnode.c:459
...
(gdb) f 0
#0  0x0000000000881052 in GetMemoryChunkContext (pointer=0x14d46e8)
    at ../../../../src/include/utils/memutils.h:124
124             AssertArg(MemoryContextIsValid(context));
(gdb) p context
$1 = (MemoryContext) 0x7f7f7f7f7f7f7f7f
(gdb) x/8x 0x14d46e8
0x14d46e8:      0x7f7f7f7f      0x7f7f7f7f      0x7f7f7f7f      0x7f7f7f7f
0x14d46f8:      0x7f7f7f7f      0x7f7f7f7f      0x7f7f7f7f      0x7f7f7f7f
(gdb) f 2
#2  0x00000000004a0492 in getNextNearest (scan=0x14709e0, 
    dir=<value optimized out>) at gistget.c:547
547                     pfree(scan->xs_hitup);

Looks like getNextNearest is trying to pfree an already-pfreed tuple.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (2+ messages)

Message-ID: <7893.1493908562@sss.pgh.pa.us>
Permalink:  ../7893.1493908562@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7893.1493908562@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, darthunix@gmail.com
  Subject: Re: BUG #14641: Segfault on searching KNN using btree_gist
  In-Reply-To: <7893.1493908562@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox