pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Nikita Glukhov <n.gluhov@postgrespro.ru>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Stas Kelvich <s.kelvich@postgrespro.ru>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: David Steele <david@pgmasters.net>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Cc: Alexander Korotkov <a.korotkov@postgrespro.ru>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Oleg Bartunov <obartunov@gmail.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Subject: Re: jsonpath
Date: Thu, 8 Nov 2018 02:52:09 +0100
Message-ID: <2265b7fe-3b0e-c437-fe15-ac1807319b73@2ndquadrant.com> (raw)
In-Reply-To: <86a0e7df-443b-3f20-70b0-655a1f5dcbb2@2ndquadrant.com>
References: <CAA8=A796mY7kJdKARt7B+faW70-c8mRh+Ff_joBJ+NyCFLv3Gg@mail.gmail.com>
	<19506.1521524178@sss.pgh.pa.us>
	<880bcbc6-1dba-cf82-7945-c10528f602c4@postgrespro.ru>
	<892ae4c4-e549-ab21-c57c-37c5fd47fda0@pgmasters.net>
	<8dd1cd76-cd4e-9be7-9515-ef0b8b21cb67@postgrespro.ru>
	<CAEepm=0jJ4fkEWLHc2Rqt5F4Und6qd+60pxFQmCnbf0nYYjrcg@mail.gmail.com>
	<3bc15ece-5219-e4ca-0b5c-fcd2b276aa26@postgrespro.ru>
	<4e2aaa88-3bbf-6af3-8dad-d5687fbec89f@postgrespro.ru>
	<42272F2B-16D1-43D6-B22F-273AE1DA6D6B@postgrespro.ru>
	<715c1c44-9bb9-6b9f-7c59-61b66578f107@postgrespro.ru>
	<20181002023317.GI11712@paquier.xyz>
	<063560d8-bc0b-945b-8796-5ba998d79dc6@2ndquadrant.com>
	<9a175c2d-b0a9-475f-078b-febc185282ff@postgrespro.ru>
	<86a0e7df-443b-3f20-70b0-655a1f5dcbb2@2ndquadrant.com>



On 11/6/18 4:48 PM, Tomas Vondra wrote:
> On 11/6/18 3:31 PM, Nikita Glukhov wrote:
>> On 29.10.2018 2:20, Tomas Vondra wrote:>
>>
>> ...
>>>
>>> 9) It's generally a good idea to make the individual pieces committable
>>> separately, but that means e.g. the regression tests have to pass after
>>> each patch. At the moment that does not seem to be the case for 0002,
>>> see the attached file. I'm running with -DRANDOMIZE_ALLOCATED_MEMORY,
>>> not sure if that's related.
>>
>> This should definitely be a bug in json support, but I can't reproduce
>> it simply by defining -DRANDOMIZE_ALLOCATED_MEMORY.  Could you provide
>> a stack trace at least?
>>
> I'll try.
> 

Not sure why you can't reproduce the failures, it's perfectly
reproducible for me. For the record, I'm doing this:

./configure --prefix=/home/user/pg-jsonpath --enable-debug
--enable-cassert CFLAGS="-O0 -DRANDOMIZE_ALLOCATED_MEMORY" && make -s
clean && make -s -j4 && make check

After sticking Assert(false) to JsonEncodeJsonbValue (to the default
case), I get a failure like this:

  select json '{}' @* 'lax $[0]';
! WARNING:  unknown jsonb value type: 20938064
! server closed the connection unexpectedly
! 	This probably means the server terminated abnormally
! 	before or while processing the request.
! connection to server was lost

The backtrace is attached. My guess is JsonValueListGetList in
jsonb_jsonpath_query only does shallow copy instead of copying the
pieces into funcctx->multi_call_memory_ctx, so it gets corrupted on
subsequent calls.

I also attach valgrind report, but I suppose the reported issues are a
consequence of the same bug.

regard

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
(gdb) bt
#0  0x00007aa8bd7ddeab in raise () from /lib64/libc.so.6
#1  0x00007aa8bd7c85b9 in abort () from /lib64/libc.so.6
#2  0x0000000000a34154 in ExceptionalCondition (conditionName=0xc6d888 "!(0)", errorType=0xc6ce18 "FailedAssertion", fileName=0xc6caa0 "json.c", lineNumber=3047) at assert.c:54
#3  0x00000000009415e7 in JsonEncodeJsonbValue (buf=0x7ffca408b870, jbv=0x7ffca408b830) at json.c:3047
#4  0x00000000009416a4 in JsonbValueToJson (jbv=0x7ffca408b830) at json.c:3077
#5  0x000000000096707c in jsonb_jsonpath_query (fcinfo=0x13f4cf0) at jsonpath_exec.c:2735
#6  0x00000000009670bb in json_jsonpath_query2 (fcinfo=0x13f4cf0) at jsonpath_exec.c:2741
#7  0x00000000006e1c18 in ExecMakeFunctionResultSet (fcache=0x13f4c80, econtext=0x13f41b8, argContext=0x13f5d40, isNull=0x13f4be0, isDone=0x13f4c60) at execSRF.c:604
#8  0x000000000070d858 in ExecProjectSRF (node=0x13f40a0, continuing=false) at nodeProjectSet.c:175
#9  0x000000000070d715 in ExecProjectSet (pstate=0x13f40a0) at nodeProjectSet.c:105
#10 0x00000000006dee78 in ExecProcNodeFirst (node=0x13f40a0) at execProcnode.c:445
#11 0x00000000006d3e56 in ExecProcNode (node=0x13f40a0) at ../../../src/include/executor/executor.h:237
#12 0x00000000006d66fa in ExecutePlan (estate=0x13f3e48, planstate=0x13f40a0, use_parallel_mode=false, operation=CMD_SELECT, sendTuples=true, numberTuples=0, direction=ForwardScanDirection, dest=0x13fa1b0, execute_once=true) at execMain.c:1707
#13 0x00000000006d447d in standard_ExecutorRun (queryDesc=0x1353768, direction=ForwardScanDirection, count=0, execute_once=true) at execMain.c:364
#14 0x00000000006d42ab in ExecutorRun (queryDesc=0x1353768, direction=ForwardScanDirection, count=0, execute_once=true) at execMain.c:307
#15 0x00000000008be5ff in PortalRunSelect (portal=0x1397348, forward=true, count=0, dest=0x13fa1b0) at pquery.c:932
#16 0x00000000008be2a4 in PortalRun (portal=0x1397348, count=9223372036854775807, isTopLevel=true, run_once=true, dest=0x13fa1b0, altdest=0x13fa1b0, completionTag=0x7ffca408be70 "") at pquery.c:773
#17 0x00000000008b8271 in exec_simple_query (query_string=0x1330738 "select json '{}' @* 'lax $[0]';") at postgres.c:1215
#18 0x00000000008bc580 in PostgresMain (argc=1, argv=0x135bab0, dbname=0x135b820 "regression", username=0x132d028 "user") at postgres.c:4243
#19 0x0000000000819f7a in BackendRun (port=0x1354940) at postmaster.c:4377
#20 0x0000000000819748 in BackendStartup (port=0x1354940) at postmaster.c:4068
#21 0x0000000000815c60 in ServerLoop () at postmaster.c:1700
#22 0x000000000081550c in PostmasterMain (argc=8, argv=0x132aeb0) at postmaster.c:1373
#23 0x000000000073ebba in main (argc=8, argv=0x132aeb0) at main.c:228
(gdb) up
#4  0x00000000009416a4 in JsonbValueToJson (jbv=0x7ffca408b830) at json.c:3077
3077		JsonEncodeJsonbValue(&buf, jbv);
(gdb) print *jbv
$1 = {type = 20938064, val = {numeric = 0x7ffca408b870, boolean = 112, string = {len = -1542932368, val = 0x0}, array = {nElems = -1542932368, elems = 0x0, rawScalar = 16}, object = {nPairs = -1542932368, uniquified = 252, pairs = 0x0}, binary = {len = -1542932368, data = 0x0}, datetime = {
      value = 140723060521072, typid = 0, typmod = 0, tz = 4684816}}}
(gdb) up
#5  0x000000000096707c in jsonb_jsonpath_query (fcinfo=0x13f4cf0) at jsonpath_exec.c:2735
2735		SRF_RETURN_NEXT(funcctx, JsonbPGetDatum(JsonbValueToJsonb(v)));
(gdb) print *v
$2 = {type = 20938064, val = {numeric = 0x7ffca408b870, boolean = 112, string = {len = -1542932368, val = 0x0}, array = {nElems = -1542932368, elems = 0x0, rawScalar = 16}, object = {nPairs = -1542932368, uniquified = 252, pairs = 0x0}, binary = {len = -1542932368, data = 0x0}, datetime = {
      value = 140723060521072, typid = 0, typmod = 0, tz = 4684816}}}
(gdb) bt full
#0  0x00007aa8bd7ddeab in raise () from /lib64/libc.so.6
No symbol table info available.
#1  0x00007aa8bd7c85b9 in abort () from /lib64/libc.so.6
No symbol table info available.
#2  0x0000000000a34154 in ExceptionalCondition (conditionName=0xc6d888 "!(0)", errorType=0xc6ce18 "FailedAssertion", fileName=0xc6caa0 "json.c", lineNumber=3047) at assert.c:54
No locals.
#3  0x00000000009415e7 in JsonEncodeJsonbValue (buf=0x7ffca408b870, jbv=0x7ffca408b830) at json.c:3047
        __func__ = "JsonEncodeJsonbValue"
#4  0x00000000009416a4 in JsonbValueToJson (jbv=0x7ffca408b830) at json.c:3077
        buf = {data = 0x13f7e90 "", len = 0, maxlen = 1024, cursor = 0}
        json = 0x13f7e68
        type = 0
        size = 7634563
#5  0x000000000096707c in jsonb_jsonpath_query (fcinfo=0x13f4cf0) at jsonpath_exec.c:2735
        rsi = 0x7ffca408b9c0
        funcctx = 0x1352708
        found = 0x13528e0
        v = 0x7ffca408b830
        c = 0x13528b8
#6  0x00000000009670bb in json_jsonpath_query2 (fcinfo=0x13f4cf0) at jsonpath_exec.c:2741
No locals.
#7  0x00000000006e1c18 in ExecMakeFunctionResultSet (fcache=0x13f4c80, econtext=0x13f41b8, argContext=0x13f5d40, isNull=0x13f4be0, isDone=0x13f4c60) at execSRF.c:604
        arguments = 0x13f5970
        result = 20938064
        fcinfo = 0x13f4cf0
        fcusage = {fs = 0x0, save_f_total_time = {tv_sec = 20923840, tv_nsec = 0}, save_total = {tv_sec = 20921648, tv_nsec = 140723060521568}, f_start = {tv_sec = 7398875, tv_nsec = 114}}
        rsinfo = {type = T_ReturnSetInfo, econtext = 0x13f41b8, expectedDesc = 0x13fe1f0, allowedModes = 3, returnMode = SFRM_ValuePerCall, isDone = ExprMultipleResult, setResult = 0x0, setDesc = 0x0}
        callit = true
        i = 2
        __func__ = "ExecMakeFunctionResultSet"
#8  0x000000000070d858 in ExecProjectSRF (node=0x13f40a0, continuing=false) at nodeProjectSet.c:175
        elem = 0x13f4c80
        isdone = 0x13f4c60
        result = 0x13f4bd8
        isnull = 0x13f4be0
        resultSlot = 0x13f4b80
        econtext = 0x13f41b8
        oldcontext = 0x13f3d30
        hassrf = false
        hasresult = false
        argno = 0
#9  0x000000000070d715 in ExecProjectSet (pstate=0x13f40a0) at nodeProjectSet.c:105
        node = 0x13f40a0
        outerTupleSlot = 0x13f44c0
        resultSlot = 0x8bb308 <check_stack_depth+12>
        outerPlan = 0x13f42b0
        econtext = 0x13f41b8
#10 0x00000000006dee78 in ExecProcNodeFirst (node=0x13f40a0) at execProcnode.c:445
No locals.
#11 0x00000000006d3e56 in ExecProcNode (node=0x13f40a0) at ../../../src/include/executor/executor.h:237
No locals.
#12 0x00000000006d66fa in ExecutePlan (estate=0x13f3e48, planstate=0x13f40a0, use_parallel_mode=false, operation=CMD_SELECT, sendTuples=true, numberTuples=0, direction=ForwardScanDirection, dest=0x13fa1b0, execute_once=true) at execMain.c:1707
        slot = 0x1397348
        current_tuple_count = 0
#13 0x00000000006d447d in standard_ExecutorRun (queryDesc=0x1353768, direction=ForwardScanDirection, count=0, execute_once=true) at execMain.c:364
        estate = 0x13f3e48
        operation = CMD_SELECT
        dest = 0x13fa1b0
        sendTuples = true
        oldcontext = 0x1353650
        __func__ = "standard_ExecutorRun"
#14 0x00000000006d42ab in ExecutorRun (queryDesc=0x1353768, direction=ForwardScanDirection, count=0, execute_once=true) at execMain.c:307
No locals.
#15 0x00000000008be5ff in PortalRunSelect (portal=0x1397348, forward=true, count=0, dest=0x13fa1b0) at pquery.c:932
        queryDesc = 0x1353768
        direction = ForwardScanDirection
        nprocessed = 140723060522208
        __func__ = "PortalRunSelect"
#16 0x00000000008be2a4 in PortalRun (portal=0x1397348, count=9223372036854775807, isTopLevel=true, run_once=true, dest=0x13fa1b0, altdest=0x13fa1b0, completionTag=0x7ffca408be70 "") at pquery.c:773
        save_exception_stack = 0x7ffca408bfb0
        save_context_stack = 0x0
        local_sigjmp_buf = {{__jmpbuf = {0, 3529150028062792428, 4684816, 140723060524240, 0, 0, 3529150027981003500, -3529900415750235412}, __mask_was_saved = 0, __saved_mask = {__val = {128, 20121120, 64, 20264936, 15304, 20264528, 20946272, 140723060522496, 10934220, 20553864, 112, 
---Type <return> to continue, or q <return> to quit---
                20947488, 112, 2, 20947376, 20121120}}}}
        result = false
        nprocessed = 0
        saveTopTransactionResourceOwner = 0x1362738
        saveTopTransactionContext = 0x13b43c0
        saveActivePortal = 0x0
        saveResourceOwner = 0x1362738
        savePortalContext = 0x0
        saveMemoryContext = 0x13b43c0
        __func__ = "PortalRun"
#17 0x00000000008b8271 in exec_simple_query (query_string=0x1330738 "select json '{}' @* 'lax $[0]';") at postgres.c:1215
        parsetree = 0x1331610
        portal = 0x1397348
        snapshot_set = true
        commandTag = 0xc5a975 "SELECT"
        completionTag = "\000\000\000\000\002\000\000\000\b\342\244", '\000' <repeats 13 times>, "P\v3\001\037\000\000\000\300\276\b\244\374\177\000\000\070\351\244\000\000\000\000\000B", '\000' <repeats 14 times>
        querytree_list = 0x13f24c8
        plantree_list = 0x13fa178
        receiver = 0x13fa1b0
        format = 0
        dest = DestRemote
        oldcontext = 0x13b43c0
        parsetree_list = 0x1331670
        parsetree_item = 0x1331648
        save_log_statement_stats = false
        was_logged = false
        use_implicit_block = false
        msec_str = "\000\277\b\244\374\177\000\000\022\270\244\000\000\000\000\000\006\000\000\000\037\000\000\000\070\a3\001\000\000\000"
        __func__ = "exec_simple_query"
#18 0x00000000008bc580 in PostgresMain (argc=1, argv=0x135bab0, dbname=0x135b820 "regression", username=0x132d028 "user") at postgres.c:4243
        query_string = 0x1330738 "select json '{}' @* 'lax $[0]';"
        firstchar = 81
        input_message = {data = 0x1330738 "select json '{}' @* 'lax $[0]';", len = 32, maxlen = 1024, cursor = 32}
        local_sigjmp_buf = {{__jmpbuf = {0, 3529150027347663596, 4684816, 140723060524240, 0, 0, 3529150028098444012, -3529900414674527508}, __mask_was_saved = 1, __saved_mask = {__val = {0, 20126752, 1024, 20121120, 0, 0, 10888111, 1024, 20126776, 140723060523136, 10892266, 20126776, 
                20121120, 30084897848, 20126776, 20126752}}}}
        send_ready_for_query = false
        disable_idle_in_transaction_timeout = false
        __func__ = "PostgresMain"
#19 0x0000000000819f7a in BackendRun (port=0x1354940) at postmaster.c:4377
        av = 0x135bab0
        maxac = 2
        ac = 1
        i = 1
        __func__ = "BackendRun"
#20 0x0000000000819748 in BackendStartup (port=0x1354940) at postmaster.c:4068
        bn = 0x1354590
        pid = 0
        __func__ = "BackendStartup"
#21 0x0000000000815c60 in ServerLoop () at postmaster.c:1700
        port = 0x1354940
        i = 0
        rmask = {fds_bits = {16, 0 <repeats 15 times>}}
        selres = 1
        now = 1541640685
        readmask = {fds_bits = {16, 0 <repeats 15 times>}}
        nSockets = 5
        last_lockfile_recheck_time = 1541640684
        last_touch_time = 1541640684
        __func__ = "ServerLoop"
#22 0x000000000081550c in PostmasterMain (argc=8, argv=0x132aeb0) at postmaster.c:1373
        opt = -1
        status = 0
        userDoption = 0x134d120 "/home/user/work/postgres/src/test/regress/./tmp_check/data"
        listen_addr_saved = false
        i = 64
        output_config_variable = 0x0
        __func__ = "PostmasterMain"
#23 0x000000000073ebba in main (argc=8, argv=0x132aeb0) at main.c:228
        do_check_root = true
==4829== Conditional jump or move depends on uninitialised value(s)
==4829==    at 0x941E53: JsonbValueToJson (json.c:3063)
==4829==    by 0x9678BA: jsonb_jsonpath_query (jsonpath_exec.c:2735)
==4829==    by 0x9678F9: json_jsonpath_query2 (jsonpath_exec.c:2741)
==4829==    by 0x6E1F4E: ExecMakeFunctionResultSet (execSRF.c:604)
==4829==    by 0x70DB8E: ExecProjectSRF (nodeProjectSet.c:175)
==4829==    by 0x70DA4B: ExecProjectSet (nodeProjectSet.c:105)
==4829==    by 0x6DF1AE: ExecProcNodeFirst (execProcnode.c:445)
==4829==    by 0x6D418C: ExecProcNode (executor.h:237)
==4829==    by 0x6D6A30: ExecutePlan (execMain.c:1707)
==4829==    by 0x6D47B3: standard_ExecutorRun (execMain.c:364)
==4829==    by 0x6D45E1: ExecutorRun (execMain.c:307)
==4829==    by 0x8BEE3D: PortalRunSelect (pquery.c:932)
==4829==    by 0x8BEAE2: PortalRun (pquery.c:773)
==4829==    by 0x8B8AAF: exec_simple_query (postgres.c:1215)
==4829==    by 0x8BCDBE: PostgresMain (postgres.c:4243)
==4829==    by 0x81A2B0: BackendRun (postmaster.c:4377)
==4829==    by 0x819A7E: BackendStartup (postmaster.c:4068)
==4829==    by 0x815F96: ServerLoop (postmaster.c:1700)
==4829==    by 0x815842: PostmasterMain (postmaster.c:1373)
==4829==    by 0x73EEF0: main (main.c:228)
==4829==  Uninitialised value was created by a stack allocation
==4829==    at 0x941E46: JsonbValueToJson (json.c:3059)
==4829== 
{
   <insert_a_suppression_name_here>
   Memcheck:Cond
   fun:JsonbValueToJson
   fun:jsonb_jsonpath_query
   fun:json_jsonpath_query2
   fun:ExecMakeFunctionResultSet
   fun:ExecProjectSRF
   fun:ExecProjectSet
   fun:ExecProcNodeFirst
   fun:ExecProcNode
   fun:ExecutePlan
   fun:standard_ExecutorRun
   fun:ExecutorRun
   fun:PortalRunSelect
   fun:PortalRun
   fun:exec_simple_query
   fun:PostgresMain
   fun:BackendRun
   fun:BackendStartup
   fun:ServerLoop
   fun:PostmasterMain
   fun:main
}
==4829== Conditional jump or move depends on uninitialised value(s)
==4829==    at 0x941A7C: JsonEncodeJsonbValue (json.c:2951)
==4829==    by 0x941EE2: JsonbValueToJson (json.c:3077)
==4829==    by 0x9678BA: jsonb_jsonpath_query (jsonpath_exec.c:2735)
==4829==    by 0x9678F9: json_jsonpath_query2 (jsonpath_exec.c:2741)
==4829==    by 0x6E1F4E: ExecMakeFunctionResultSet (execSRF.c:604)
==4829==    by 0x70DB8E: ExecProjectSRF (nodeProjectSet.c:175)
==4829==    by 0x70DA4B: ExecProjectSet (nodeProjectSet.c:105)
==4829==    by 0x6DF1AE: ExecProcNodeFirst (execProcnode.c:445)
==4829==    by 0x6D418C: ExecProcNode (executor.h:237)
==4829==    by 0x6D6A30: ExecutePlan (execMain.c:1707)
==4829==    by 0x6D47B3: standard_ExecutorRun (execMain.c:364)
==4829==    by 0x6D45E1: ExecutorRun (execMain.c:307)
==4829==    by 0x8BEE3D: PortalRunSelect (pquery.c:932)
==4829==    by 0x8BEAE2: PortalRun (pquery.c:773)
==4829==    by 0x8B8AAF: exec_simple_query (postgres.c:1215)
==4829==    by 0x8BCDBE: PostgresMain (postgres.c:4243)
==4829==    by 0x81A2B0: BackendRun (postmaster.c:4377)
==4829==    by 0x819A7E: BackendStartup (postmaster.c:4068)
==4829==    by 0x815F96: ServerLoop (postmaster.c:1700)
==4829==    by 0x815842: PostmasterMain (postmaster.c:1373)
==4829==  Uninitialised value was created by a stack allocation
==4829==    at 0x941A52: JsonEncodeJsonbValue (json.c:2948)
==4829== 
{
   <insert_a_suppression_name_here>
   Memcheck:Cond
   fun:JsonEncodeJsonbValue
   fun:JsonbValueToJson
   fun:jsonb_jsonpath_query
   fun:json_jsonpath_query2
   fun:ExecMakeFunctionResultSet
   fun:ExecProjectSRF
   fun:ExecProjectSet
   fun:ExecProcNodeFirst
   fun:ExecProcNode
   fun:ExecutePlan
   fun:standard_ExecutorRun
   fun:ExecutorRun
   fun:PortalRunSelect
   fun:PortalRun
   fun:exec_simple_query
   fun:PostgresMain
   fun:BackendRun
   fun:BackendStartup
   fun:ServerLoop
   fun:PostmasterMain
}
==4829== Conditional jump or move depends on uninitialised value(s)
==4829==    at 0xA9BEF7: adjust_sign (snprintf.c:1436)
==4829==    by 0xA9B533: fmtint (snprintf.c:1050)
==4829==    by 0xA9A70C: dopr (snprintf.c:614)
==4829==    by 0xA99C28: pg_vsnprintf (snprintf.c:195)
==4829==    by 0xAA0C48: pvsnprintf (psprintf.c:110)
==4829==    by 0x72ACBB: appendStringInfoVA (stringinfo.c:136)
==4829==    by 0xA379E0: elog_finish (elog.c:1359)
==4829==    by 0x941E0C: JsonEncodeJsonbValue (json.c:3046)
==4829==    by 0x941EE2: JsonbValueToJson (json.c:3077)
==4829==    by 0x9678BA: jsonb_jsonpath_query (jsonpath_exec.c:2735)
==4829==    by 0x9678F9: json_jsonpath_query2 (jsonpath_exec.c:2741)
==4829==    by 0x6E1F4E: ExecMakeFunctionResultSet (execSRF.c:604)
==4829==    by 0x70DB8E: ExecProjectSRF (nodeProjectSet.c:175)
==4829==    by 0x70DA4B: ExecProjectSet (nodeProjectSet.c:105)
==4829==    by 0x6DF1AE: ExecProcNodeFirst (execProcnode.c:445)
==4829==    by 0x6D418C: ExecProcNode (executor.h:237)
==4829==    by 0x6D6A30: ExecutePlan (execMain.c:1707)
==4829==    by 0x6D47B3: standard_ExecutorRun (execMain.c:364)
==4829==    by 0x6D45E1: ExecutorRun (execMain.c:307)
==4829==    by 0x8BEE3D: PortalRunSelect (pquery.c:932)
==4829==  Uninitialised value was created by a stack allocation
==4829==    at 0x941A52: JsonEncodeJsonbValue (json.c:2948)
==4829== 
{
   <insert_a_suppression_name_here>
   Memcheck:Cond
   fun:adjust_sign
   fun:fmtint
   fun:dopr
   fun:pg_vsnprintf
   fun:pvsnprintf
   fun:appendStringInfoVA
   fun:elog_finish
   fun:JsonEncodeJsonbValue
   fun:JsonbValueToJson
   fun:jsonb_jsonpath_query
   fun:json_jsonpath_query2
   fun:ExecMakeFunctionResultSet
   fun:ExecProjectSRF
   fun:ExecProjectSet
   fun:ExecProcNodeFirst
   fun:ExecProcNode
   fun:ExecutePlan
   fun:standard_ExecutorRun
   fun:ExecutorRun
   fun:PortalRunSelect
}
==4829== Conditional jump or move depends on uninitialised value(s)
==4829==    at 0xA9B55B: fmtint (snprintf.c:1059)
==4829==    by 0xA9A70C: dopr (snprintf.c:614)
==4829==    by 0xA99C28: pg_vsnprintf (snprintf.c:195)
==4829==    by 0xAA0C48: pvsnprintf (psprintf.c:110)
==4829==    by 0x72ACBB: appendStringInfoVA (stringinfo.c:136)
==4829==    by 0xA379E0: elog_finish (elog.c:1359)
==4829==    by 0x941E0C: JsonEncodeJsonbValue (json.c:3046)
==4829==    by 0x941EE2: JsonbValueToJson (json.c:3077)
==4829==    by 0x9678BA: jsonb_jsonpath_query (jsonpath_exec.c:2735)
==4829==    by 0x9678F9: json_jsonpath_query2 (jsonpath_exec.c:2741)
==4829==    by 0x6E1F4E: ExecMakeFunctionResultSet (execSRF.c:604)
==4829==    by 0x70DB8E: ExecProjectSRF (nodeProjectSet.c:175)
==4829==    by 0x70DA4B: ExecProjectSet (nodeProjectSet.c:105)
==4829==    by 0x6DF1AE: ExecProcNodeFirst (execProcnode.c:445)
==4829==    by 0x6D418C: ExecProcNode (executor.h:237)
==4829==    by 0x6D6A30: ExecutePlan (execMain.c:1707)
==4829==    by 0x6D47B3: standard_ExecutorRun (execMain.c:364)
==4829==    by 0x6D45E1: ExecutorRun (execMain.c:307)
==4829==    by 0x8BEE3D: PortalRunSelect (pquery.c:932)
==4829==    by 0x8BEAE2: PortalRun (pquery.c:773)
==4829==  Uninitialised value was created by a stack allocation
==4829==    at 0x941A52: JsonEncodeJsonbValue (json.c:2948)
==4829== 
{
   <insert_a_suppression_name_here>
   Memcheck:Cond
   fun:fmtint
   fun:dopr
   fun:pg_vsnprintf
   fun:pvsnprintf
   fun:appendStringInfoVA
   fun:elog_finish
   fun:JsonEncodeJsonbValue
   fun:JsonbValueToJson
   fun:jsonb_jsonpath_query
   fun:json_jsonpath_query2
   fun:ExecMakeFunctionResultSet
   fun:ExecProjectSRF
   fun:ExecProjectSet
   fun:ExecProcNodeFirst
   fun:ExecProcNode
   fun:ExecutePlan
   fun:standard_ExecutorRun
   fun:ExecutorRun
   fun:PortalRunSelect
   fun:PortalRun
}
==4829== Use of uninitialised value of size 8
==4829==    at 0xA9B59B: fmtint (snprintf.c:1066)
==4829==    by 0xA9A70C: dopr (snprintf.c:614)
==4829==    by 0xA99C28: pg_vsnprintf (snprintf.c:195)
==4829==    by 0xAA0C48: pvsnprintf (psprintf.c:110)
==4829==    by 0x72ACBB: appendStringInfoVA (stringinfo.c:136)
==4829==    by 0xA379E0: elog_finish (elog.c:1359)
==4829==    by 0x941E0C: JsonEncodeJsonbValue (json.c:3046)
==4829==    by 0x941EE2: JsonbValueToJson (json.c:3077)
==4829==    by 0x9678BA: jsonb_jsonpath_query (jsonpath_exec.c:2735)
==4829==    by 0x9678F9: json_jsonpath_query2 (jsonpath_exec.c:2741)
==4829==    by 0x6E1F4E: ExecMakeFunctionResultSet (execSRF.c:604)
==4829==    by 0x70DB8E: ExecProjectSRF (nodeProjectSet.c:175)
==4829==    by 0x70DA4B: ExecProjectSet (nodeProjectSet.c:105)
==4829==    by 0x6DF1AE: ExecProcNodeFirst (execProcnode.c:445)
==4829==    by 0x6D418C: ExecProcNode (executor.h:237)
==4829==    by 0x6D6A30: ExecutePlan (execMain.c:1707)
==4829==    by 0x6D47B3: standard_ExecutorRun (execMain.c:364)
==4829==    by 0x6D45E1: ExecutorRun (execMain.c:307)
==4829==    by 0x8BEE3D: PortalRunSelect (pquery.c:932)
==4829==    by 0x8BEAE2: PortalRun (pquery.c:773)
==4829==  Uninitialised value was created by a stack allocation
==4829==    at 0x941A52: JsonEncodeJsonbValue (json.c:2948)
==4829== 
{
   <insert_a_suppression_name_here>
   Memcheck:Value8
   fun:fmtint
   fun:dopr
   fun:pg_vsnprintf
   fun:pvsnprintf
   fun:appendStringInfoVA
   fun:elog_finish
   fun:JsonEncodeJsonbValue
   fun:JsonbValueToJson
   fun:jsonb_jsonpath_query
   fun:json_jsonpath_query2
   fun:ExecMakeFunctionResultSet
   fun:ExecProjectSRF
   fun:ExecProjectSet
   fun:ExecProcNodeFirst
   fun:ExecProcNode
   fun:ExecutePlan
   fun:standard_ExecutorRun
   fun:ExecutorRun
   fun:PortalRunSelect
   fun:PortalRun
}
==4829== Conditional jump or move depends on uninitialised value(s)
==4829==    at 0xA9B5B8: fmtint (snprintf.c:1068)
==4829==    by 0xA9A70C: dopr (snprintf.c:614)
==4829==    by 0xA99C28: pg_vsnprintf (snprintf.c:195)
==4829==    by 0xAA0C48: pvsnprintf (psprintf.c:110)
==4829==    by 0x72ACBB: appendStringInfoVA (stringinfo.c:136)
==4829==    by 0xA379E0: elog_finish (elog.c:1359)
==4829==    by 0x941E0C: JsonEncodeJsonbValue (json.c:3046)
==4829==    by 0x941EE2: JsonbValueToJson (json.c:3077)
==4829==    by 0x9678BA: jsonb_jsonpath_query (jsonpath_exec.c:2735)
==4829==    by 0x9678F9: json_jsonpath_query2 (jsonpath_exec.c:2741)
==4829==    by 0x6E1F4E: ExecMakeFunctionResultSet (execSRF.c:604)
==4829==    by 0x70DB8E: ExecProjectSRF (nodeProjectSet.c:175)
==4829==    by 0x70DA4B: ExecProjectSet (nodeProjectSet.c:105)
==4829==    by 0x6DF1AE: ExecProcNodeFirst (execProcnode.c:445)
==4829==    by 0x6D418C: ExecProcNode (executor.h:237)
==4829==    by 0x6D6A30: ExecutePlan (execMain.c:1707)
==4829==    by 0x6D47B3: standard_ExecutorRun (execMain.c:364)
==4829==    by 0x6D45E1: ExecutorRun (execMain.c:307)
==4829==    by 0x8BEE3D: PortalRunSelect (pquery.c:932)
==4829==    by 0x8BEAE2: PortalRun (pquery.c:773)
==4829==  Uninitialised value was created by a stack allocation
==4829==    at 0x941A52: JsonEncodeJsonbValue (json.c:2948)
==4829== 
{
   <insert_a_suppression_name_here>
   Memcheck:Cond
   fun:fmtint
   fun:dopr
   fun:pg_vsnprintf
   fun:pvsnprintf
   fun:appendStringInfoVA
   fun:elog_finish
   fun:JsonEncodeJsonbValue
   fun:JsonbValueToJson
   fun:jsonb_jsonpath_query
   fun:json_jsonpath_query2
   fun:ExecMakeFunctionResultSet
   fun:ExecProjectSRF
   fun:ExecProjectSet
   fun:ExecProcNodeFirst
   fun:ExecProcNode
   fun:ExecutePlan
   fun:standard_ExecutorRun
   fun:ExecutorRun
   fun:PortalRunSelect
   fun:PortalRun
}

Attachments:

  [text/plain] jsonpath-bt.txt (11.1K, ../2265b7fe-3b0e-c437-fe15-ac1807319b73@2ndquadrant.com/2-jsonpath-bt.txt)
  download | inline:
(gdb) bt
#0  0x00007aa8bd7ddeab in raise () from /lib64/libc.so.6
#1  0x00007aa8bd7c85b9 in abort () from /lib64/libc.so.6
#2  0x0000000000a34154 in ExceptionalCondition (conditionName=0xc6d888 "!(0)", errorType=0xc6ce18 "FailedAssertion", fileName=0xc6caa0 "json.c", lineNumber=3047) at assert.c:54
#3  0x00000000009415e7 in JsonEncodeJsonbValue (buf=0x7ffca408b870, jbv=0x7ffca408b830) at json.c:3047
#4  0x00000000009416a4 in JsonbValueToJson (jbv=0x7ffca408b830) at json.c:3077
#5  0x000000000096707c in jsonb_jsonpath_query (fcinfo=0x13f4cf0) at jsonpath_exec.c:2735
#6  0x00000000009670bb in json_jsonpath_query2 (fcinfo=0x13f4cf0) at jsonpath_exec.c:2741
#7  0x00000000006e1c18 in ExecMakeFunctionResultSet (fcache=0x13f4c80, econtext=0x13f41b8, argContext=0x13f5d40, isNull=0x13f4be0, isDone=0x13f4c60) at execSRF.c:604
#8  0x000000000070d858 in ExecProjectSRF (node=0x13f40a0, continuing=false) at nodeProjectSet.c:175
#9  0x000000000070d715 in ExecProjectSet (pstate=0x13f40a0) at nodeProjectSet.c:105
#10 0x00000000006dee78 in ExecProcNodeFirst (node=0x13f40a0) at execProcnode.c:445
#11 0x00000000006d3e56 in ExecProcNode (node=0x13f40a0) at ../../../src/include/executor/executor.h:237
#12 0x00000000006d66fa in ExecutePlan (estate=0x13f3e48, planstate=0x13f40a0, use_parallel_mode=false, operation=CMD_SELECT, sendTuples=true, numberTuples=0, direction=ForwardScanDirection, dest=0x13fa1b0, execute_once=true) at execMain.c:1707
#13 0x00000000006d447d in standard_ExecutorRun (queryDesc=0x1353768, direction=ForwardScanDirection, count=0, execute_once=true) at execMain.c:364
#14 0x00000000006d42ab in ExecutorRun (queryDesc=0x1353768, direction=ForwardScanDirection, count=0, execute_once=true) at execMain.c:307
#15 0x00000000008be5ff in PortalRunSelect (portal=0x1397348, forward=true, count=0, dest=0x13fa1b0) at pquery.c:932
#16 0x00000000008be2a4 in PortalRun (portal=0x1397348, count=9223372036854775807, isTopLevel=true, run_once=true, dest=0x13fa1b0, altdest=0x13fa1b0, completionTag=0x7ffca408be70 "") at pquery.c:773
#17 0x00000000008b8271 in exec_simple_query (query_string=0x1330738 "select json '{}' @* 'lax $[0]';") at postgres.c:1215
#18 0x00000000008bc580 in PostgresMain (argc=1, argv=0x135bab0, dbname=0x135b820 "regression", username=0x132d028 "user") at postgres.c:4243
#19 0x0000000000819f7a in BackendRun (port=0x1354940) at postmaster.c:4377
#20 0x0000000000819748 in BackendStartup (port=0x1354940) at postmaster.c:4068
#21 0x0000000000815c60 in ServerLoop () at postmaster.c:1700
#22 0x000000000081550c in PostmasterMain (argc=8, argv=0x132aeb0) at postmaster.c:1373
#23 0x000000000073ebba in main (argc=8, argv=0x132aeb0) at main.c:228
(gdb) up
#4  0x00000000009416a4 in JsonbValueToJson (jbv=0x7ffca408b830) at json.c:3077
3077		JsonEncodeJsonbValue(&buf, jbv);
(gdb) print *jbv
$1 = {type = 20938064, val = {numeric = 0x7ffca408b870, boolean = 112, string = {len = -1542932368, val = 0x0}, array = {nElems = -1542932368, elems = 0x0, rawScalar = 16}, object = {nPairs = -1542932368, uniquified = 252, pairs = 0x0}, binary = {len = -1542932368, data = 0x0}, datetime = {
      value = 140723060521072, typid = 0, typmod = 0, tz = 4684816}}}
(gdb) up
#5  0x000000000096707c in jsonb_jsonpath_query (fcinfo=0x13f4cf0) at jsonpath_exec.c:2735
2735		SRF_RETURN_NEXT(funcctx, JsonbPGetDatum(JsonbValueToJsonb(v)));
(gdb) print *v
$2 = {type = 20938064, val = {numeric = 0x7ffca408b870, boolean = 112, string = {len = -1542932368, val = 0x0}, array = {nElems = -1542932368, elems = 0x0, rawScalar = 16}, object = {nPairs = -1542932368, uniquified = 252, pairs = 0x0}, binary = {len = -1542932368, data = 0x0}, datetime = {
      value = 140723060521072, typid = 0, typmod = 0, tz = 4684816}}}
(gdb) bt full
#0  0x00007aa8bd7ddeab in raise () from /lib64/libc.so.6
No symbol table info available.
#1  0x00007aa8bd7c85b9 in abort () from /lib64/libc.so.6
No symbol table info available.
#2  0x0000000000a34154 in ExceptionalCondition (conditionName=0xc6d888 "!(0)", errorType=0xc6ce18 "FailedAssertion", fileName=0xc6caa0 "json.c", lineNumber=3047) at assert.c:54
No locals.
#3  0x00000000009415e7 in JsonEncodeJsonbValue (buf=0x7ffca408b870, jbv=0x7ffca408b830) at json.c:3047
        __func__ = "JsonEncodeJsonbValue"
#4  0x00000000009416a4 in JsonbValueToJson (jbv=0x7ffca408b830) at json.c:3077
        buf = {data = 0x13f7e90 "", len = 0, maxlen = 1024, cursor = 0}
        json = 0x13f7e68
        type = 0
        size = 7634563
#5  0x000000000096707c in jsonb_jsonpath_query (fcinfo=0x13f4cf0) at jsonpath_exec.c:2735
        rsi = 0x7ffca408b9c0
        funcctx = 0x1352708
        found = 0x13528e0
        v = 0x7ffca408b830
        c = 0x13528b8
#6  0x00000000009670bb in json_jsonpath_query2 (fcinfo=0x13f4cf0) at jsonpath_exec.c:2741
No locals.
#7  0x00000000006e1c18 in ExecMakeFunctionResultSet (fcache=0x13f4c80, econtext=0x13f41b8, argContext=0x13f5d40, isNull=0x13f4be0, isDone=0x13f4c60) at execSRF.c:604
        arguments = 0x13f5970
        result = 20938064
        fcinfo = 0x13f4cf0
        fcusage = {fs = 0x0, save_f_total_time = {tv_sec = 20923840, tv_nsec = 0}, save_total = {tv_sec = 20921648, tv_nsec = 140723060521568}, f_start = {tv_sec = 7398875, tv_nsec = 114}}
        rsinfo = {type = T_ReturnSetInfo, econtext = 0x13f41b8, expectedDesc = 0x13fe1f0, allowedModes = 3, returnMode = SFRM_ValuePerCall, isDone = ExprMultipleResult, setResult = 0x0, setDesc = 0x0}
        callit = true
        i = 2
        __func__ = "ExecMakeFunctionResultSet"
#8  0x000000000070d858 in ExecProjectSRF (node=0x13f40a0, continuing=false) at nodeProjectSet.c:175
        elem = 0x13f4c80
        isdone = 0x13f4c60
        result = 0x13f4bd8
        isnull = 0x13f4be0
        resultSlot = 0x13f4b80
        econtext = 0x13f41b8
        oldcontext = 0x13f3d30
        hassrf = false
        hasresult = false
        argno = 0
#9  0x000000000070d715 in ExecProjectSet (pstate=0x13f40a0) at nodeProjectSet.c:105
        node = 0x13f40a0
        outerTupleSlot = 0x13f44c0
        resultSlot = 0x8bb308 <check_stack_depth+12>
        outerPlan = 0x13f42b0
        econtext = 0x13f41b8
#10 0x00000000006dee78 in ExecProcNodeFirst (node=0x13f40a0) at execProcnode.c:445
No locals.
#11 0x00000000006d3e56 in ExecProcNode (node=0x13f40a0) at ../../../src/include/executor/executor.h:237
No locals.
#12 0x00000000006d66fa in ExecutePlan (estate=0x13f3e48, planstate=0x13f40a0, use_parallel_mode=false, operation=CMD_SELECT, sendTuples=true, numberTuples=0, direction=ForwardScanDirection, dest=0x13fa1b0, execute_once=true) at execMain.c:1707
        slot = 0x1397348
        current_tuple_count = 0
#13 0x00000000006d447d in standard_ExecutorRun (queryDesc=0x1353768, direction=ForwardScanDirection, count=0, execute_once=true) at execMain.c:364
        estate = 0x13f3e48
        operation = CMD_SELECT
        dest = 0x13fa1b0
        sendTuples = true
        oldcontext = 0x1353650
        __func__ = "standard_ExecutorRun"
#14 0x00000000006d42ab in ExecutorRun (queryDesc=0x1353768, direction=ForwardScanDirection, count=0, execute_once=true) at execMain.c:307
No locals.
#15 0x00000000008be5ff in PortalRunSelect (portal=0x1397348, forward=true, count=0, dest=0x13fa1b0) at pquery.c:932
        queryDesc = 0x1353768
        direction = ForwardScanDirection
        nprocessed = 140723060522208
        __func__ = "PortalRunSelect"
#16 0x00000000008be2a4 in PortalRun (portal=0x1397348, count=9223372036854775807, isTopLevel=true, run_once=true, dest=0x13fa1b0, altdest=0x13fa1b0, completionTag=0x7ffca408be70 "") at pquery.c:773
        save_exception_stack = 0x7ffca408bfb0
        save_context_stack = 0x0
        local_sigjmp_buf = {{__jmpbuf = {0, 3529150028062792428, 4684816, 140723060524240, 0, 0, 3529150027981003500, -3529900415750235412}, __mask_was_saved = 0, __saved_mask = {__val = {128, 20121120, 64, 20264936, 15304, 20264528, 20946272, 140723060522496, 10934220, 20553864, 112, 
---Type <return> to continue, or q <return> to quit---
                20947488, 112, 2, 20947376, 20121120}}}}
        result = false
        nprocessed = 0
        saveTopTransactionResourceOwner = 0x1362738
        saveTopTransactionContext = 0x13b43c0
        saveActivePortal = 0x0
        saveResourceOwner = 0x1362738
        savePortalContext = 0x0
        saveMemoryContext = 0x13b43c0
        __func__ = "PortalRun"
#17 0x00000000008b8271 in exec_simple_query (query_string=0x1330738 "select json '{}' @* 'lax $[0]';") at postgres.c:1215
        parsetree = 0x1331610
        portal = 0x1397348
        snapshot_set = true
        commandTag = 0xc5a975 "SELECT"
        completionTag = "\000\000\000\000\002\000\000\000\b\342\244", '\000' <repeats 13 times>, "P\v3\001\037\000\000\000\300\276\b\244\374\177\000\000\070\351\244\000\000\000\000\000B", '\000' <repeats 14 times>
        querytree_list = 0x13f24c8
        plantree_list = 0x13fa178
        receiver = 0x13fa1b0
        format = 0
        dest = DestRemote
        oldcontext = 0x13b43c0
        parsetree_list = 0x1331670
        parsetree_item = 0x1331648
        save_log_statement_stats = false
        was_logged = false
        use_implicit_block = false
        msec_str = "\000\277\b\244\374\177\000\000\022\270\244\000\000\000\000\000\006\000\000\000\037\000\000\000\070\a3\001\000\000\000"
        __func__ = "exec_simple_query"
#18 0x00000000008bc580 in PostgresMain (argc=1, argv=0x135bab0, dbname=0x135b820 "regression", username=0x132d028 "user") at postgres.c:4243
        query_string = 0x1330738 "select json '{}' @* 'lax $[0]';"
        firstchar = 81
        input_message = {data = 0x1330738 "select json '{}' @* 'lax $[0]';", len = 32, maxlen = 1024, cursor = 32}
        local_sigjmp_buf = {{__jmpbuf = {0, 3529150027347663596, 4684816, 140723060524240, 0, 0, 3529150028098444012, -3529900414674527508}, __mask_was_saved = 1, __saved_mask = {__val = {0, 20126752, 1024, 20121120, 0, 0, 10888111, 1024, 20126776, 140723060523136, 10892266, 20126776, 
                20121120, 30084897848, 20126776, 20126752}}}}
        send_ready_for_query = false
        disable_idle_in_transaction_timeout = false
        __func__ = "PostgresMain"
#19 0x0000000000819f7a in BackendRun (port=0x1354940) at postmaster.c:4377
        av = 0x135bab0
        maxac = 2
        ac = 1
        i = 1
        __func__ = "BackendRun"
#20 0x0000000000819748 in BackendStartup (port=0x1354940) at postmaster.c:4068
        bn = 0x1354590
        pid = 0
        __func__ = "BackendStartup"
#21 0x0000000000815c60 in ServerLoop () at postmaster.c:1700
        port = 0x1354940
        i = 0
        rmask = {fds_bits = {16, 0 <repeats 15 times>}}
        selres = 1
        now = 1541640685
        readmask = {fds_bits = {16, 0 <repeats 15 times>}}
        nSockets = 5
        last_lockfile_recheck_time = 1541640684
        last_touch_time = 1541640684
        __func__ = "ServerLoop"
#22 0x000000000081550c in PostmasterMain (argc=8, argv=0x132aeb0) at postmaster.c:1373
        opt = -1
        status = 0
        userDoption = 0x134d120 "/home/user/work/postgres/src/test/regress/./tmp_check/data"
        listen_addr_saved = false
        i = 64
        output_config_variable = 0x0
        __func__ = "PostmasterMain"
#23 0x000000000073ebba in main (argc=8, argv=0x132aeb0) at main.c:228
        do_check_root = true

  [text/plain] jsonpath-valgrind.txt (11.0K, ../2265b7fe-3b0e-c437-fe15-ac1807319b73@2ndquadrant.com/3-jsonpath-valgrind.txt)
  download | inline:
==4829== Conditional jump or move depends on uninitialised value(s)
==4829==    at 0x941E53: JsonbValueToJson (json.c:3063)
==4829==    by 0x9678BA: jsonb_jsonpath_query (jsonpath_exec.c:2735)
==4829==    by 0x9678F9: json_jsonpath_query2 (jsonpath_exec.c:2741)
==4829==    by 0x6E1F4E: ExecMakeFunctionResultSet (execSRF.c:604)
==4829==    by 0x70DB8E: ExecProjectSRF (nodeProjectSet.c:175)
==4829==    by 0x70DA4B: ExecProjectSet (nodeProjectSet.c:105)
==4829==    by 0x6DF1AE: ExecProcNodeFirst (execProcnode.c:445)
==4829==    by 0x6D418C: ExecProcNode (executor.h:237)
==4829==    by 0x6D6A30: ExecutePlan (execMain.c:1707)
==4829==    by 0x6D47B3: standard_ExecutorRun (execMain.c:364)
==4829==    by 0x6D45E1: ExecutorRun (execMain.c:307)
==4829==    by 0x8BEE3D: PortalRunSelect (pquery.c:932)
==4829==    by 0x8BEAE2: PortalRun (pquery.c:773)
==4829==    by 0x8B8AAF: exec_simple_query (postgres.c:1215)
==4829==    by 0x8BCDBE: PostgresMain (postgres.c:4243)
==4829==    by 0x81A2B0: BackendRun (postmaster.c:4377)
==4829==    by 0x819A7E: BackendStartup (postmaster.c:4068)
==4829==    by 0x815F96: ServerLoop (postmaster.c:1700)
==4829==    by 0x815842: PostmasterMain (postmaster.c:1373)
==4829==    by 0x73EEF0: main (main.c:228)
==4829==  Uninitialised value was created by a stack allocation
==4829==    at 0x941E46: JsonbValueToJson (json.c:3059)
==4829== 
{
   <insert_a_suppression_name_here>
   Memcheck:Cond
   fun:JsonbValueToJson
   fun:jsonb_jsonpath_query
   fun:json_jsonpath_query2
   fun:ExecMakeFunctionResultSet
   fun:ExecProjectSRF
   fun:ExecProjectSet
   fun:ExecProcNodeFirst
   fun:ExecProcNode
   fun:ExecutePlan
   fun:standard_ExecutorRun
   fun:ExecutorRun
   fun:PortalRunSelect
   fun:PortalRun
   fun:exec_simple_query
   fun:PostgresMain
   fun:BackendRun
   fun:BackendStartup
   fun:ServerLoop
   fun:PostmasterMain
   fun:main
}
==4829== Conditional jump or move depends on uninitialised value(s)
==4829==    at 0x941A7C: JsonEncodeJsonbValue (json.c:2951)
==4829==    by 0x941EE2: JsonbValueToJson (json.c:3077)
==4829==    by 0x9678BA: jsonb_jsonpath_query (jsonpath_exec.c:2735)
==4829==    by 0x9678F9: json_jsonpath_query2 (jsonpath_exec.c:2741)
==4829==    by 0x6E1F4E: ExecMakeFunctionResultSet (execSRF.c:604)
==4829==    by 0x70DB8E: ExecProjectSRF (nodeProjectSet.c:175)
==4829==    by 0x70DA4B: ExecProjectSet (nodeProjectSet.c:105)
==4829==    by 0x6DF1AE: ExecProcNodeFirst (execProcnode.c:445)
==4829==    by 0x6D418C: ExecProcNode (executor.h:237)
==4829==    by 0x6D6A30: ExecutePlan (execMain.c:1707)
==4829==    by 0x6D47B3: standard_ExecutorRun (execMain.c:364)
==4829==    by 0x6D45E1: ExecutorRun (execMain.c:307)
==4829==    by 0x8BEE3D: PortalRunSelect (pquery.c:932)
==4829==    by 0x8BEAE2: PortalRun (pquery.c:773)
==4829==    by 0x8B8AAF: exec_simple_query (postgres.c:1215)
==4829==    by 0x8BCDBE: PostgresMain (postgres.c:4243)
==4829==    by 0x81A2B0: BackendRun (postmaster.c:4377)
==4829==    by 0x819A7E: BackendStartup (postmaster.c:4068)
==4829==    by 0x815F96: ServerLoop (postmaster.c:1700)
==4829==    by 0x815842: PostmasterMain (postmaster.c:1373)
==4829==  Uninitialised value was created by a stack allocation
==4829==    at 0x941A52: JsonEncodeJsonbValue (json.c:2948)
==4829== 
{
   <insert_a_suppression_name_here>
   Memcheck:Cond
   fun:JsonEncodeJsonbValue
   fun:JsonbValueToJson
   fun:jsonb_jsonpath_query
   fun:json_jsonpath_query2
   fun:ExecMakeFunctionResultSet
   fun:ExecProjectSRF
   fun:ExecProjectSet
   fun:ExecProcNodeFirst
   fun:ExecProcNode
   fun:ExecutePlan
   fun:standard_ExecutorRun
   fun:ExecutorRun
   fun:PortalRunSelect
   fun:PortalRun
   fun:exec_simple_query
   fun:PostgresMain
   fun:BackendRun
   fun:BackendStartup
   fun:ServerLoop
   fun:PostmasterMain
}
==4829== Conditional jump or move depends on uninitialised value(s)
==4829==    at 0xA9BEF7: adjust_sign (snprintf.c:1436)
==4829==    by 0xA9B533: fmtint (snprintf.c:1050)
==4829==    by 0xA9A70C: dopr (snprintf.c:614)
==4829==    by 0xA99C28: pg_vsnprintf (snprintf.c:195)
==4829==    by 0xAA0C48: pvsnprintf (psprintf.c:110)
==4829==    by 0x72ACBB: appendStringInfoVA (stringinfo.c:136)
==4829==    by 0xA379E0: elog_finish (elog.c:1359)
==4829==    by 0x941E0C: JsonEncodeJsonbValue (json.c:3046)
==4829==    by 0x941EE2: JsonbValueToJson (json.c:3077)
==4829==    by 0x9678BA: jsonb_jsonpath_query (jsonpath_exec.c:2735)
==4829==    by 0x9678F9: json_jsonpath_query2 (jsonpath_exec.c:2741)
==4829==    by 0x6E1F4E: ExecMakeFunctionResultSet (execSRF.c:604)
==4829==    by 0x70DB8E: ExecProjectSRF (nodeProjectSet.c:175)
==4829==    by 0x70DA4B: ExecProjectSet (nodeProjectSet.c:105)
==4829==    by 0x6DF1AE: ExecProcNodeFirst (execProcnode.c:445)
==4829==    by 0x6D418C: ExecProcNode (executor.h:237)
==4829==    by 0x6D6A30: ExecutePlan (execMain.c:1707)
==4829==    by 0x6D47B3: standard_ExecutorRun (execMain.c:364)
==4829==    by 0x6D45E1: ExecutorRun (execMain.c:307)
==4829==    by 0x8BEE3D: PortalRunSelect (pquery.c:932)
==4829==  Uninitialised value was created by a stack allocation
==4829==    at 0x941A52: JsonEncodeJsonbValue (json.c:2948)
==4829== 
{
   <insert_a_suppression_name_here>
   Memcheck:Cond
   fun:adjust_sign
   fun:fmtint
   fun:dopr
   fun:pg_vsnprintf
   fun:pvsnprintf
   fun:appendStringInfoVA
   fun:elog_finish
   fun:JsonEncodeJsonbValue
   fun:JsonbValueToJson
   fun:jsonb_jsonpath_query
   fun:json_jsonpath_query2
   fun:ExecMakeFunctionResultSet
   fun:ExecProjectSRF
   fun:ExecProjectSet
   fun:ExecProcNodeFirst
   fun:ExecProcNode
   fun:ExecutePlan
   fun:standard_ExecutorRun
   fun:ExecutorRun
   fun:PortalRunSelect
}
==4829== Conditional jump or move depends on uninitialised value(s)
==4829==    at 0xA9B55B: fmtint (snprintf.c:1059)
==4829==    by 0xA9A70C: dopr (snprintf.c:614)
==4829==    by 0xA99C28: pg_vsnprintf (snprintf.c:195)
==4829==    by 0xAA0C48: pvsnprintf (psprintf.c:110)
==4829==    by 0x72ACBB: appendStringInfoVA (stringinfo.c:136)
==4829==    by 0xA379E0: elog_finish (elog.c:1359)
==4829==    by 0x941E0C: JsonEncodeJsonbValue (json.c:3046)
==4829==    by 0x941EE2: JsonbValueToJson (json.c:3077)
==4829==    by 0x9678BA: jsonb_jsonpath_query (jsonpath_exec.c:2735)
==4829==    by 0x9678F9: json_jsonpath_query2 (jsonpath_exec.c:2741)
==4829==    by 0x6E1F4E: ExecMakeFunctionResultSet (execSRF.c:604)
==4829==    by 0x70DB8E: ExecProjectSRF (nodeProjectSet.c:175)
==4829==    by 0x70DA4B: ExecProjectSet (nodeProjectSet.c:105)
==4829==    by 0x6DF1AE: ExecProcNodeFirst (execProcnode.c:445)
==4829==    by 0x6D418C: ExecProcNode (executor.h:237)
==4829==    by 0x6D6A30: ExecutePlan (execMain.c:1707)
==4829==    by 0x6D47B3: standard_ExecutorRun (execMain.c:364)
==4829==    by 0x6D45E1: ExecutorRun (execMain.c:307)
==4829==    by 0x8BEE3D: PortalRunSelect (pquery.c:932)
==4829==    by 0x8BEAE2: PortalRun (pquery.c:773)
==4829==  Uninitialised value was created by a stack allocation
==4829==    at 0x941A52: JsonEncodeJsonbValue (json.c:2948)
==4829== 
{
   <insert_a_suppression_name_here>
   Memcheck:Cond
   fun:fmtint
   fun:dopr
   fun:pg_vsnprintf
   fun:pvsnprintf
   fun:appendStringInfoVA
   fun:elog_finish
   fun:JsonEncodeJsonbValue
   fun:JsonbValueToJson
   fun:jsonb_jsonpath_query
   fun:json_jsonpath_query2
   fun:ExecMakeFunctionResultSet
   fun:ExecProjectSRF
   fun:ExecProjectSet
   fun:ExecProcNodeFirst
   fun:ExecProcNode
   fun:ExecutePlan
   fun:standard_ExecutorRun
   fun:ExecutorRun
   fun:PortalRunSelect
   fun:PortalRun
}
==4829== Use of uninitialised value of size 8
==4829==    at 0xA9B59B: fmtint (snprintf.c:1066)
==4829==    by 0xA9A70C: dopr (snprintf.c:614)
==4829==    by 0xA99C28: pg_vsnprintf (snprintf.c:195)
==4829==    by 0xAA0C48: pvsnprintf (psprintf.c:110)
==4829==    by 0x72ACBB: appendStringInfoVA (stringinfo.c:136)
==4829==    by 0xA379E0: elog_finish (elog.c:1359)
==4829==    by 0x941E0C: JsonEncodeJsonbValue (json.c:3046)
==4829==    by 0x941EE2: JsonbValueToJson (json.c:3077)
==4829==    by 0x9678BA: jsonb_jsonpath_query (jsonpath_exec.c:2735)
==4829==    by 0x9678F9: json_jsonpath_query2 (jsonpath_exec.c:2741)
==4829==    by 0x6E1F4E: ExecMakeFunctionResultSet (execSRF.c:604)
==4829==    by 0x70DB8E: ExecProjectSRF (nodeProjectSet.c:175)
==4829==    by 0x70DA4B: ExecProjectSet (nodeProjectSet.c:105)
==4829==    by 0x6DF1AE: ExecProcNodeFirst (execProcnode.c:445)
==4829==    by 0x6D418C: ExecProcNode (executor.h:237)
==4829==    by 0x6D6A30: ExecutePlan (execMain.c:1707)
==4829==    by 0x6D47B3: standard_ExecutorRun (execMain.c:364)
==4829==    by 0x6D45E1: ExecutorRun (execMain.c:307)
==4829==    by 0x8BEE3D: PortalRunSelect (pquery.c:932)
==4829==    by 0x8BEAE2: PortalRun (pquery.c:773)
==4829==  Uninitialised value was created by a stack allocation
==4829==    at 0x941A52: JsonEncodeJsonbValue (json.c:2948)
==4829== 
{
   <insert_a_suppression_name_here>
   Memcheck:Value8
   fun:fmtint
   fun:dopr
   fun:pg_vsnprintf
   fun:pvsnprintf
   fun:appendStringInfoVA
   fun:elog_finish
   fun:JsonEncodeJsonbValue
   fun:JsonbValueToJson
   fun:jsonb_jsonpath_query
   fun:json_jsonpath_query2
   fun:ExecMakeFunctionResultSet
   fun:ExecProjectSRF
   fun:ExecProjectSet
   fun:ExecProcNodeFirst
   fun:ExecProcNode
   fun:ExecutePlan
   fun:standard_ExecutorRun
   fun:ExecutorRun
   fun:PortalRunSelect
   fun:PortalRun
}
==4829== Conditional jump or move depends on uninitialised value(s)
==4829==    at 0xA9B5B8: fmtint (snprintf.c:1068)
==4829==    by 0xA9A70C: dopr (snprintf.c:614)
==4829==    by 0xA99C28: pg_vsnprintf (snprintf.c:195)
==4829==    by 0xAA0C48: pvsnprintf (psprintf.c:110)
==4829==    by 0x72ACBB: appendStringInfoVA (stringinfo.c:136)
==4829==    by 0xA379E0: elog_finish (elog.c:1359)
==4829==    by 0x941E0C: JsonEncodeJsonbValue (json.c:3046)
==4829==    by 0x941EE2: JsonbValueToJson (json.c:3077)
==4829==    by 0x9678BA: jsonb_jsonpath_query (jsonpath_exec.c:2735)
==4829==    by 0x9678F9: json_jsonpath_query2 (jsonpath_exec.c:2741)
==4829==    by 0x6E1F4E: ExecMakeFunctionResultSet (execSRF.c:604)
==4829==    by 0x70DB8E: ExecProjectSRF (nodeProjectSet.c:175)
==4829==    by 0x70DA4B: ExecProjectSet (nodeProjectSet.c:105)
==4829==    by 0x6DF1AE: ExecProcNodeFirst (execProcnode.c:445)
==4829==    by 0x6D418C: ExecProcNode (executor.h:237)
==4829==    by 0x6D6A30: ExecutePlan (execMain.c:1707)
==4829==    by 0x6D47B3: standard_ExecutorRun (execMain.c:364)
==4829==    by 0x6D45E1: ExecutorRun (execMain.c:307)
==4829==    by 0x8BEE3D: PortalRunSelect (pquery.c:932)
==4829==    by 0x8BEAE2: PortalRun (pquery.c:773)
==4829==  Uninitialised value was created by a stack allocation
==4829==    at 0x941A52: JsonEncodeJsonbValue (json.c:2948)
==4829== 
{
   <insert_a_suppression_name_here>
   Memcheck:Cond
   fun:fmtint
   fun:dopr
   fun:pg_vsnprintf
   fun:pvsnprintf
   fun:appendStringInfoVA
   fun:elog_finish
   fun:JsonEncodeJsonbValue
   fun:JsonbValueToJson
   fun:jsonb_jsonpath_query
   fun:json_jsonpath_query2
   fun:ExecMakeFunctionResultSet
   fun:ExecProjectSRF
   fun:ExecProjectSet
   fun:ExecProcNodeFirst
   fun:ExecProcNode
   fun:ExecutePlan
   fun:standard_ExecutorRun
   fun:ExecutorRun
   fun:PortalRunSelect
   fun:PortalRun
}

view thread (198+ messages)  latest in thread

Message-ID: <2265b7fe-3b0e-c437-fe15-ac1807319b73@2ndquadrant.com>
Permalink:  ../2265b7fe-3b0e-c437-fe15-ac1807319b73@2ndquadrant.com/
Also on:    postgresql.org/message-id/2265b7fe-3b0e-c437-fe15-ac1807319b73@2ndquadrant.com

 · 

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-hackers@postgresql.org
  Cc: tomas.vondra@2ndquadrant.com, n.gluhov@postgrespro.ru, michael@paquier.xyz, s.kelvich@postgrespro.ru, thomas.munro@enterprisedb.com, david@pgmasters.net, tgl@sss.pgh.pa.us, andrew.dunstan@2ndquadrant.com, a.korotkov@postgrespro.ru, robertmhaas@gmail.com, obartunov@gmail.com, pavel.stehule@gmail.com
  Subject: Re: jsonpath
  In-Reply-To: <2265b7fe-3b0e-c437-fe15-ac1807319b73@2ndquadrant.com>

* 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