Re: [PATCH] Silence Valgrind about SelectConfigFiles()

From: Aleksander Alekseev <aleksander(at)tigerdata(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: [PATCH] Silence Valgrind about SelectConfigFiles()
Date: 2025-08-13 23:35:52
Message-ID: CAJ7c6TOBsWa3wD2gfJTWWmMSfbprC6kP8wUQvhppoEsXLDer7A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Tom,

> You didn't say what the test condition was, but from the patch
> I suppose it's a case where SelectConfigFiles is erroring out?

Steps to reproduce:

1. Uncomment USE_VALGRIND in src/include/pg_config_manual.h, then
rebuild and setup Postgres as usual

2. In the first terminal:

```
$ valgrind \
--leak-check=full \
--track-origins=yes \
--gen-suppressions=all \
--read-var-info=yes \
--log-file=/tmp/valgrind/%p.log \
--suppressions=src/tools/valgrind.supp \
--time-stamp=yes \
--trace-children=yes \
postgres -D /home/eax/pginstall/data \
2>&1 | tee /tmp/valgrind/postmaster.log
```

3. In the second terminal:

```
meson test -C build \
--setup running \
--suite regress-running \
--timeout-multiplier 0
pg_ctl -w -D /home/eax/pginstall/data stop
grep -r 'ERROR SUMMARY' /tmp/valgrind/ | grep -v 'SUMMARY: 0 errors'
```

> Kind of hard to get excited about preventing a leak in that path,
> since we're going to exit immediately.

It's not exciting at all but given the fact that this is the only
"definitely lost" error I got it's worth fixing IMO ("broken windows"
and all that). I should have also pointed out that SelectConfigFiles()
sometimes calls free(configdir) and sometimes doesn't, which is
inconsistent.

Sorry for little details in the first email - it's 2:30 AM in my time zone :)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2025-08-13 23:50:59 Re: index prefetching
Previous Message Tomas Vondra 2025-08-13 23:22:28 Re: index prefetching