Re: Consolidate 'unique array values' logic into a reusable function?

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Consolidate 'unique array values' logic into a reusable function?
Date: 2020-01-08 01:49:48
Message-ID: CA+hUKGJKGpniqYVNaOf0NJnah2vG1xcZG3jRkQu1CDYegghfXw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Dec 29, 2019 at 8:02 PM Noah Misch <noah(at)leadboat(dot)com> wrote:
> ==00:00:00:28.322 1527557== Source and destination overlap in memcpy(0x1000104, 0x1000104, 4)
> ==00:00:00:28.322 1527557== at 0x4C2E74D: memcpy@@GLIBC_2.14 (vg_replace_strmem.c:1035)
> ==00:00:00:28.322 1527557== by 0xA9A57B: qunique (qunique.h:34)
> ==00:00:00:28.322 1527557== by 0xA9A843: InitCatalogCache (syscache.c:1056)
> ==00:00:00:28.322 1527557== by 0xAB6B18: InitPostgres (postinit.c:682)
> ==00:00:00:28.322 1527557== by 0x91F98E: PostgresMain (postgres.c:3909)
> ==00:00:00:28.322 1527557== by 0x872DE9: BackendRun (postmaster.c:4498)
> ==00:00:00:28.322 1527557== by 0x8725B3: BackendStartup (postmaster.c:4189)
> ==00:00:00:28.322 1527557== by 0x86E7F4: ServerLoop (postmaster.c:1727)
> ==00:00:00:28.322 1527557== by 0x86E0AA: PostmasterMain (postmaster.c:1400)
> ==00:00:00:28.322 1527557== by 0x77CB56: main (main.c:210)
> ==00:00:00:28.322 1527557==
> {
> <insert_a_suppression_name_here>
> Memcheck:Overlap
> fun:memcpy@@GLIBC_2.14
> fun:qunique
> fun:InitCatalogCache
> fun:InitPostgres
> fun:PostgresMain
> fun:BackendRun
> fun:BackendStartup
> fun:ServerLoop
> fun:PostmasterMain
> fun:main
> }
>
> This is like the problem fixed in 9a9473f; the precedent from there would be
> to test src!=dst before calling mempcy(), e.g. as attached. I suppose the
> alternative would be to add a suppression like the one 9a9473f removed.

Thanks for fixing that.

> I do wonder why the Valgrind buildfarm animals haven't noticed.

Optimisation levels? For example, I see that skink is using -Og, at
which level my local GCC inlines qunique() and memcpy() so that in the
case you quoted there's a MOV instruction and valgrind has nothing to
complain about.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-01-08 01:56:01 Re: Assert failure due to "drop schema pg_temp_3 cascade" for temporary tables and \d+ is not showing any info after drooping temp table schema
Previous Message David Kimura 2020-01-08 01:40:12 Re: Make autovacuum sort tables in descending order of xid_age