BUG #15217: Valgrind - writing uninitialised byte(s) in FileWrite - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #15217: Valgrind - writing uninitialised byte(s) in FileWrite
Date
Msg-id 152765297018.1287.16667772151157129465@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #15217: Valgrind - writing uninitialised byte(s) in FileWrite
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      15217
Logged by:          Alexander Lakhin
Email address:      exclusion@gmail.com
PostgreSQL version: 10.4
Operating system:   Ubuntu 16.04
Description:

Hello,

When running PostgreSQL (REL_10_STABLE) under valgrind I am getting the
following error messages sporadically:

==00:03:26:22.952 1623== Syscall param write(buf) points to uninitialised
byte(s)
==00:03:26:22.952 1623==    at 0x4E4A4A0: __write_nocancel
(syscall-template.S:84)
==00:03:26:22.952 1623==    by 0x72F0EF: FileWrite (fd.c:1773)
==00:03:26:22.952 1623==    by 0x7310D1: BufFileDumpBuffer (buffile.c:324)
==00:03:26:22.952 1623==    by 0x7313F1: BufFileFlush (buffile.c:466)
==00:03:26:22.952 1623==    by 0x7313F1: BufFileRead (buffile.c:372)
==00:03:26:22.952 1623==    by 0x894958: ltsReadBlock (logtape.c:248)
==00:03:26:22.952 1623==    by 0x894A34: ltsReadFillBuffer (logtape.c:275)
==00:03:26:22.952 1623==    by 0x89CB9F: mergeruns (tuplesort.c:2683)
==00:03:26:22.952 1623==    by 0x89CB9F: tuplesort_performsort
(tuplesort.c:1823)
==00:03:26:22.952 1623==    by 0x6414C2: ExecSort (nodeSort.c:117)
==00:03:26:22.952 1623==    by 0x6296F8: ExecProcNode (executor.h:250)
==00:03:26:22.952 1623==    by 0x6296F8: fetch_input_tuple (nodeAgg.c:695)
==00:03:26:22.952 1623==    by 0x62BBBA: agg_retrieve_direct
(nodeAgg.c:2347)
==00:03:26:22.952 1623==    by 0x62BBBA: ExecAgg (nodeAgg.c:2158)
==00:03:26:22.952 1623==    by 0x638AE6: ExecProcNode (executor.h:250)
==00:03:26:22.952 1623==    by 0x638AE6: gather_merge_readnext
(nodeGatherMerge.c:634)
==00:03:26:22.952 1623==    by 0x638E5C: gather_merge_init
(nodeGatherMerge.c:468)
==00:03:26:22.952 1623==    by 0x638E5C: gather_merge_getnext
(nodeGatherMerge.c:536)
==00:03:26:22.952 1623==    by 0x638E5C: ExecGatherMerge
(nodeGatherMerge.c:250)
==00:03:26:22.952 1623==  Address 0xfa8a27e is 6,350 bytes inside a block of
size 8,256 client-defined
==00:03:26:22.952 1623==    at 0x88FC20: palloc (mcxt.c:872)
==00:03:26:22.952 1623==    by 0x7312CF: makeBufFile (buffile.c:107)
==00:03:26:22.952 1623==    by 0x7312CF: BufFileCreateTemp (buffile.c:175)
==00:03:26:22.952 1623==    by 0x894B14: LogicalTapeSetCreate
(logtape.c:390)
==00:03:26:22.952 1623==    by 0x89B2F2: inittapes (tuplesort.c:2410)
==00:03:26:22.952 1623==    by 0x89B2F2: puttuple_common
(tuplesort.c:1622)
==00:03:26:22.952 1623==    by 0x89C4CE: tuplesort_putheaptuple
(tuplesort.c:1397)
==00:03:26:22.952 1623==    by 0x6414A0: ExecSort (nodeSort.c:111)
==00:03:26:22.952 1623==    by 0x6296F8: ExecProcNode (executor.h:250)
==00:03:26:22.952 1623==    by 0x6296F8: fetch_input_tuple (nodeAgg.c:695)
==00:03:26:22.952 1623==    by 0x62BBBA: agg_retrieve_direct
(nodeAgg.c:2347)
==00:03:26:22.952 1623==    by 0x62BBBA: ExecAgg (nodeAgg.c:2158)
==00:03:26:22.952 1623==    by 0x638AE6: ExecProcNode (executor.h:250)
==00:03:26:22.952 1623==    by 0x638AE6: gather_merge_readnext
(nodeGatherMerge.c:634)
==00:03:26:22.952 1623==    by 0x638E5C: gather_merge_init
(nodeGatherMerge.c:468)
==00:03:26:22.952 1623==    by 0x638E5C: gather_merge_getnext
(nodeGatherMerge.c:536)
==00:03:26:22.952 1623==    by 0x638E5C: ExecGatherMerge
(nodeGatherMerge.c:250)
==00:03:26:22.952 1623==    by 0x6296F8: ExecProcNode (executor.h:250)
==00:03:26:22.952 1623==    by 0x6296F8: fetch_input_tuple (nodeAgg.c:695)
==00:03:26:22.952 1623==    by 0x62BBBA: agg_retrieve_direct
(nodeAgg.c:2347)
==00:03:26:22.952 1623==    by 0x62BBBA: ExecAgg (nodeAgg.c:2158)
==00:03:26:22.952 1623==  Uninitialised value was created by a heap
allocation
==00:03:26:22.952 1623==    at 0x88FC20: palloc (mcxt.c:872)
==00:03:26:22.952 1623==    by 0x894DC2: LogicalTapeWrite (logtape.c:476)
==00:03:26:22.952 1623==    by 0x895D81: writetup_heap (tuplesort.c:3757)
==00:03:26:22.952 1623==    by 0x89AEE9: dumpbatch (tuplesort.c:3100)
==00:03:26:22.952 1623==    by 0x89AEE9: dumptuples (tuplesort.c:2972)
==00:03:26:22.952 1623==    by 0x89CA0B: tuplesort_performsort
(tuplesort.c:1822)
==00:03:26:22.952 1623==    by 0x6414C2: ExecSort (nodeSort.c:117)
==00:03:26:22.952 1623==    by 0x6296F8: ExecProcNode (executor.h:250)
==00:03:26:22.952 1623==    by 0x6296F8: fetch_input_tuple (nodeAgg.c:695)
==00:03:26:22.952 1623==    by 0x62BBBA: agg_retrieve_direct
(nodeAgg.c:2347)
==00:03:26:22.952 1623==    by 0x62BBBA: ExecAgg (nodeAgg.c:2158)
==00:03:26:22.952 1623==    by 0x638AE6: ExecProcNode (executor.h:250)
==00:03:26:22.952 1623==    by 0x638AE6: gather_merge_readnext
(nodeGatherMerge.c:634)
==00:03:26:22.952 1623==    by 0x638E5C: gather_merge_init
(nodeGatherMerge.c:468)
==00:03:26:22.952 1623==    by 0x638E5C: gather_merge_getnext
(nodeGatherMerge.c:536)
==00:03:26:22.952 1623==    by 0x638E5C: ExecGatherMerge
(nodeGatherMerge.c:250)
==00:03:26:22.952 1623==    by 0x6296F8: ExecProcNode (executor.h:250)
==00:03:26:22.952 1623==    by 0x6296F8: fetch_input_tuple (nodeAgg.c:695)
==00:03:26:22.952 1623==    by 0x62BBBA: agg_retrieve_direct
(nodeAgg.c:2347)
==00:03:26:22.952 1623==    by 0x62BBBA: ExecAgg (nodeAgg.c:2158)
==00:03:26:22.952 1623== 
{
   <insert_a_suppression_name_here>
   Memcheck:Param
   write(buf)
   fun:__write_nocancel
   fun:FileWrite
   fun:BufFileDumpBuffer
   fun:BufFileFlush
   fun:BufFileRead
   fun:ltsReadBlock
   fun:ltsReadFillBuffer
   fun:mergeruns
   fun:tuplesort_performsort
   fun:ExecSort
   fun:ExecProcNode
   fun:fetch_input_tuple
   fun:agg_retrieve_direct
   fun:ExecAgg
   fun:ExecProcNode
   fun:gather_merge_readnext
   fun:gather_merge_init
   fun:gather_merge_getnext
   fun:ExecGatherMerge
}

Is this something that needs further investigation (and fix) or it just
looks like a false positive (and should be added to valgrind.supp)?


pgsql-bugs by date:

Previous
From: "158306855"
Date:
Subject: [BUG] postgresql replaying WAL slowly when master drop a large number of relations in one transaction
Next
From: Peter Geoghegan
Date:
Subject: Re: BUG #15217: Valgrind - writing uninitialised byte(s) in FileWrite