[postgis-devel] running PostGIS on valgrind-enabled build /identifying memory issues
Tomas Vondra
tomas.vondra at 2ndquadrant.com
Sat Feb 10 04:57:58 PST 2018
Hi Brian,
On 02/10/2018 07:29 AM, Brian M Hamlin wrote:
> Hi Tomas -
>
> Using a current PostGIS 2.4 / Pg 10.2 / GEOS 3.6.2 on Ubuntu 1604
> I built PostGIS using the CFLAGS you indicated, installed, then ran
> valgrind make test. The log is not showing a lot of errors. I admit I
> have not looked at your sample log.
> Am I missing a step here? best regards --Brian
>
> --
> pgs_work$ ./configure --enable-debug --enable-cassert CFLAGS='-Og -ggdb3
> -fno-omit-frame-pointer -DUSE_VALGRIND -DRANDOMIZE_ALLOCATED_MEMORY'
> --
> pgs_work$ valgrind --log-file=/tmp/pg1.log make check
>
I suspect the misunderstanding is that this only starts the "make" under
valgrind, not the actual postgres backends. That would explain the lack
of any reported issues in your case.
It also seems you only did the ./configure in postgis source tree.
That's not enough, it's the PostgreSQL that needs to be built with
valgrind support (it's built into the memory context/allocator code).
Let me share more detailed instructions:
1) build PostgreSQL with valgrind support
git clone git://git.postgresql.org/git/postgresql.git postgres
cd postgres
# patch pg_ctl to start postgres under valgrind
# FIXME: modify the paths for suppress and log file
patch -p1 < pg_ctl.patch
./configure --enable-debug --enable-cassert --prefix=XYZ \
CFLAGS='-Og -ggdb3 -fno-omit-frame-pointer -DUSE_VALGRIND \
-DRANDOMIZE_ALLOCATED_MEMORY'
make install
2) build postgis against the valgrind-enabled postgres build
git clone https://git.osgeo.org/gitea/postgis/postgis.git postgis
cd postgis
# FIXME: tweak the path to include the prefix of postgres build
export PATH=XYZ:$PATH
./autogen.sh
# no need to repeat the configure options (will be inherited from
# PostgreSQL build thanks to pg_config)
./configure ...
make install
3) start PostgreSQL (will take a while, thanks to running in valgrind)
pg_ctl -D ... init
pg_ctl -D ... start
4) run "make check" in postgis
Hope this helps in reproducing the valgrind reports.
I'm not sure how much this depends on valgrind version - I'm running
3.13.0 (the latest stable version) and I also tried running under custom
build of the current master branch (essentially 3.13.0 + commits since
July 2017). I get about the same results in both cases.
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
More information about the postgis-devel
mailing list