Re: [PATCH] Silence Valgrind about SelectConfigFiles() - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Re: [PATCH] Silence Valgrind about SelectConfigFiles()
Date
Msg-id CAJ7c6TOBsWa3wD2gfJTWWmMSfbprC6kP8wUQvhppoEsXLDer7A@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Silence Valgrind about SelectConfigFiles()  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [PATCH] Silence Valgrind about SelectConfigFiles()
List 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 :)



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: index prefetching
Next
From: "Peter Geoghegan"
Date:
Subject: Re: index prefetching