Re: Valgrind failures caused by multivariate stats patch

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Tomas Vondra <tv(at)fuzzy(dot)cz>
Subject: Re: Valgrind failures caused by multivariate stats patch
Date: 2017-03-26 21:13:09
Message-ID: b35d100a-1d13-c6e3-2992-9789cf13de09@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 03/26/2017 08:47 PM, Andres Freund wrote:
> On 2017-03-26 20:38:52 +0200, Tomas Vondra wrote:
>> ...
>> Hmmm, so I have a theory about what's going on, but no matter what I do I
>> can't trigger these valgrind failures. What switches are you using to start
>> valgrind? I'm using this:
>>
>> valgrind --leak-check=no --undef-value-errors=yes \
>> --expensive-definedness-checks=yes --track-origins=yes \
>> --read-var-info=yes --gen-suppressions=all \
>> --suppressions=src/tools/valgrind.supp --time-stamp=yes \
>> --log-file=$HOME/pg-valgrind/%p.log --trace-children=yes \
>> postgres --log_line_prefix="%m %p " --log_statement=all \
>> --shared_buffers=64MB -D /home/user/tmp/data-valgrind 2>&1
>
> --quiet \
> --error-exitcode=55 \
> --suppressions=${PG_SRC_DIR}/src/tools/valgrind.supp \
> --trace-children=yes --track-origins=yes --read-var-info=yes \
> --num-callers=20 \
> --leak-check=no \
> --gen-suppressions=all \
>
> the error-exitcode makes it a whole lot easier to see an error, because
> it triggers a crash-restart cycle at backend exit ;)
>

OK, this did the trick. And just as I suspected, it seems to be due to
doing memcpy+offsetof when serializing the statistic into a bytea. The
attached patch fixes that for me. Can you test it on your build?

regards

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

Attachment Content-Type Size
ndistinct-valgrind-fix.patch text/x-diff 2.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2017-03-26 21:42:10 Re: \if, \elseif, \else, \endif (was Re: PSQL commands: \quit_if, \quit_unless)
Previous Message Andres Freund 2017-03-26 20:41:28 Re: WIP: [[Parallel] Shared] Hash