Re: jsonpath

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>, obartunov(at)gmail(dot)com
Cc: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: jsonpath
Date: 2018-03-05 21:29:13
Message-ID: 698a11a8-2ed6-7477-2fa0-9a7c262e6c3c@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

The patch no longer applies - it got broken by fd1a421fe66 which changed
columns in pg_proc. A rebase is needed.

Fixing it is pretty simle, so I've done that locally and tried to run
'make check' under valgrind. And I got a bunch of reports about
uninitialised values. Full report attached, but in general there seem to
be two types of failures:

Conditional jump or move depends on uninitialised value(s)
at 0x57BB47A: vfprintf (in /usr/lib64/libc-2.24.so)
by 0x57E5478: vsnprintf (in /usr/lib64/libc-2.24.so)
by 0xA926D3: pvsnprintf (psprintf.c:121)
by 0x723E03: appendStringInfoVA (stringinfo.c:130)
by 0x723D58: appendStringInfo (stringinfo.c:87)
by 0x76BEFF: _outCoerceViaIO (outfuncs.c:1413)
by 0x776F99: outNode (outfuncs.c:3978)
by 0x76D7E7: _outJsonCoercion (outfuncs.c:1779)
by 0x777CB9: outNode (outfuncs.c:4398)
by 0x76D507: _outJsonExpr (outfuncs.c:1752)
by 0x777CA1: outNode (outfuncs.c:4395)
by 0x767000: _outList (outfuncs.c:187)
by 0x776874: outNode (outfuncs.c:3753)
by 0x76A4D2: _outTableFunc (outfuncs.c:1068)
by 0x776D89: outNode (outfuncs.c:3912)
by 0x7744FD: _outRangeTblEntry (outfuncs.c:3209)
by 0x777959: outNode (outfuncs.c:4290)
by 0x767000: _outList (outfuncs.c:187)
by 0x776874: outNode (outfuncs.c:3753)
by 0x773713: _outQuery (outfuncs.c:3049)
Uninitialised value was created by a stack allocation
at 0x5B0C19: base_yyparse (gram.c:26287)

This happens when _outCoerceViaIO tries to output 'location' field
(that's line 1413), so I guess it's not set/copied somewhere.

The second failure looks like this:

Conditional jump or move depends on uninitialised value(s)
at 0x49E58B: ginFillScanEntry (ginscan.c:72)
by 0x49EB56: ginFillScanKey (ginscan.c:221)
by 0x49EF72: ginNewScanKey (ginscan.c:369)
by 0x4A3875: gingetbitmap (ginget.c:1807)
by 0x4F620B: index_getbitmap (indexam.c:727)
by 0x6EE342: MultiExecBitmapIndexScan (nodeBitmapIndexscan.c:104)
by 0x6DA8F8: MultiExecProcNode (execProcnode.c:506)
by 0x6EC53D: BitmapHeapNext (nodeBitmapHeapscan.c:118)
by 0x6DC26D: ExecScanFetch (execScan.c:95)
by 0x6DC308: ExecScan (execScan.c:162)
by 0x6ED7E5: ExecBitmapHeapScan (nodeBitmapHeapscan.c:730)
by 0x6DA80A: ExecProcNodeFirst (execProcnode.c:446)
by 0x6E5961: ExecProcNode (executor.h:239)
by 0x6E5E25: fetch_input_tuple (nodeAgg.c:406)
by 0x6E8091: agg_retrieve_direct (nodeAgg.c:1736)
by 0x6E7C84: ExecAgg (nodeAgg.c:1551)
by 0x6DA80A: ExecProcNodeFirst (execProcnode.c:446)
by 0x6D1361: ExecProcNode (executor.h:239)
by 0x6D3BB7: ExecutePlan (execMain.c:1721)
by 0x6D1917: standard_ExecutorRun (execMain.c:361)
Uninitialised value was created by a heap allocation
at 0xA64FDC: palloc (mcxt.c:858)
by 0x938636: gin_extract_jsonpath_query (jsonb_gin.c:630)
by 0x938AB6: gin_extract_jsonb_query (jsonb_gin.c:746)
by 0xA340C0: FunctionCall7Coll (fmgr.c:1201)
by 0x49EE7F: ginNewScanKey (ginscan.c:313)
by 0x4A3875: gingetbitmap (ginget.c:1807)
by 0x4F620B: index_getbitmap (indexam.c:727)
by 0x6EE342: MultiExecBitmapIndexScan (nodeBitmapIndexscan.c:104)
by 0x6DA8F8: MultiExecProcNode (execProcnode.c:506)
by 0x6EC53D: BitmapHeapNext (nodeBitmapHeapscan.c:118)
by 0x6DC26D: ExecScanFetch (execScan.c:95)
by 0x6DC308: ExecScan (execScan.c:162)
by 0x6ED7E5: ExecBitmapHeapScan (nodeBitmapHeapscan.c:730)
by 0x6DA80A: ExecProcNodeFirst (execProcnode.c:446)
by 0x6E5961: ExecProcNode (executor.h:239)
by 0x6E5E25: fetch_input_tuple (nodeAgg.c:406)
by 0x6E8091: agg_retrieve_direct (nodeAgg.c:1736)
by 0x6E7C84: ExecAgg (nodeAgg.c:1551)
by 0x6DA80A: ExecProcNodeFirst (execProcnode.c:446)
by 0x6D1361: ExecProcNode (executor.h:239)

So the extra_data allocated in gin_extract_jsonpath_query() get to
ginFillScanEntry() uninitialised.

Both seem like a valid issues, I think.

regards

--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
valgrind.log text/x-log 23.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2018-03-05 21:32:12 Re: select_parallel test failure: gather sometimes losing tuples (maybe during rescans)?
Previous Message Daniel Gustafsson 2018-03-05 21:20:17 Re: [HACKERS] Optional message to user when terminating/cancelling backend