BUG #16329: Valgrind detects an invalid read when building a gist index with buffering

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: exclusion(at)gmail(dot)com
Subject: BUG #16329: Valgrind detects an invalid read when building a gist index with buffering
Date: 2020-03-29 21:00:01
Message-ID: 16329-7a6aa9b6fa1118a1@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 16329
Logged by: Alexander Lakhin
Email address: exclusion(at)gmail(dot)com
PostgreSQL version: 12.2
Operating system: Ubuntu 18.04
Description:

Running the following query under valgrind:
create table gist_point_tbl(id int4, p point);
insert into gist_point_tbl (id, p)
select g, point(g*10+1, g*10+1) from generate_series(1, 30000) g;
create index gist_pointidx2 on gist_point_tbl using gist(p) with (buffering
= on, fillfactor=50);

leads to a memory access error:
==00:00:00:08.755 18585== Invalid read of size 2
==00:00:00:08.756 18585== at 0x1F94CA: gistBuildCallback
(gistbuild.c:495)
==00:00:00:08.756 18585== by 0x21F556: heapam_index_build_range_scan
(heapam_handler.c:1664)
==00:00:00:08.756 18585== by 0x1F972F: table_index_build_scan
(tableam.h:1522)
==00:00:00:08.756 18585== by 0x1F972F: gistbuild (gistbuild.c:196)
==00:00:00:08.756 18585== by 0x29D1FE: index_build (index.c:2909)
==00:00:00:08.756 18585== by 0x29EAC8: index_create (index.c:1221)
==00:00:00:08.756 18585== by 0x348C60: DefineIndex (indexcmds.c:1005)
==00:00:00:08.756 18585== by 0x52B518: ProcessUtilitySlow
(utility.c:1372)
==00:00:00:08.756 18585== by 0x52AAC5: standard_ProcessUtility
(utility.c:927)
==00:00:00:08.756 18585== by 0x52AB73: ProcessUtility (utility.c:360)
==00:00:00:08.756 18585== by 0x527025: PortalRunUtility (pquery.c:1175)
==00:00:00:08.756 18585== by 0x527C6F: PortalRunMulti (pquery.c:1321)
==00:00:00:08.756 18585== by 0x5289DE: PortalRun (pquery.c:796)
==00:00:00:08.756 18585== Address 0x8a4ca1e is 398 bytes inside a block of
size 8,192 alloc'd
==00:00:00:08.756 18585== at 0x4C2FBFF: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==00:00:00:08.756 18585== by 0x6781E6: AllocSetContextCreateInternal
(aset.c:477)
==00:00:00:08.756 18585== by 0x3BF065: ExecInitFunctionScan
(nodeFunctionscan.c:508)
==00:00:00:08.756 18585== by 0x3ACE6F: ExecInitNode
(execProcnode.c:247)
==00:00:00:08.756 18585== by 0x3D03E1: ExecInitModifyTable
(nodeModifyTable.c:2363)
==00:00:00:08.756 18585== by 0x3ACD4C: ExecInitNode
(execProcnode.c:174)
==00:00:00:08.756 18585== by 0x3A70F3: InitPlan (execMain.c:1020)
==00:00:00:08.756 18585== by 0x3A7299: standard_ExecutorStart
(execMain.c:266)
==00:00:00:08.756 18585== by 0x3A739B: ExecutorStart (execMain.c:148)
==00:00:00:08.756 18585== by 0x527936: ProcessQuery (pquery.c:156)
==00:00:00:08.756 18585== by 0x527B34: PortalRunMulti (pquery.c:1283)
==00:00:00:08.756 18585== by 0x5289DE: PortalRun (pquery.c:796)

Reproduced at least on REL_10_STABLE..master.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Hugh Wang 2020-03-30 02:10:10 Re: BUG #16321: Memory leaks in PostmasterMain
Previous Message PG Bug reporting form 2020-03-29 20:33:43 BUG #16328: Generated column and inheritance: strange default error