[postgis-devel] PostGIS 3.2.0beta3 is released

Justin Pryzby pryzby at telsasoft.com
Fri Dec 10 06:46:58 PST 2021


On Fri, Dec 10, 2021 at 09:18:55AM -0500, Greg Troxel wrote:
> Thanks again for the gdb hints.  All makes sense, but the \i of the test
> was a big help for me.

You could also start postgres using pg_ctl -D data_dir --core-files, or make
sure to launch it with "ulimit -c unlimited".  Then you'll get a core file
(maybe in postgres' datadir), and you can run something like

gdb ./postgres ./core.12345
..
bt full

> Running the geography test gets me
> 
> (gdb) bt
> #0  0x000074dc1b56f15a in _lwp_kill () from /usr/lib/libc.so.12
> #1  0x000074dc1b56e0d4 in abort () from /usr/lib/libc.so.12
> #2  0x000074dc0d85ce8f in ?? ()
> #3  0x0000000000000000 in ?? ()

This looks like the stack was corrupted.

> which seems not that useful, and I shoudl rebuild with -g -O0, but I see
> in /usr/pkg/pgsq/errlog
> 
> 2021-12-10 09:13:46.783 EST [927] ERROR:  Must specify precision
> 2021-12-10 09:13:46.783 EST [927] STATEMENT:  SELECT 't2', ST_QuantizeCoordinates('POINT (3 7)', NULL);

Many postgres regression tests deliberately cause errors, to exercize those
code paths and verify the behavior.  I think this is just the previous command
which was intended to fail.  See ./regress/core/quantize_coordinates_expected.

I suggest to test with postgres compiled with --enable-cassert --enable-debug.
This might allow the test to crash before the stack is corrupted.  That should
be done in a non-production environment, since cassert has a big performance
penalty.

I'm not sure how anyone else debugs memory corruption, but one way is to start
postgres in single-user mode, under valgrind, and run the failing query.  From
your previous message, that's this.  Valgrind would hopefully show the function
causing the corruption, and the allocation being corrupted.

|SELECT c, abs(ST_Distance(ply::geography, pt::geography) - _ST_DistanceUnCached(ply::geography, pt::geography)) < 0.01 FROM
|          ( VALUES
|          ('geog_distance_cached_1a', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
|          ('geog_distance_cached_1b', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
|          ('geog_distance_cached_1c', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
|          ('geog_distance_cached_1e', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
|          ('geog_distance_cached_1f', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
|          ('geog_distance_cached_1g', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
|          ('geog_distance_cached_1h', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)')
|          ) AS u(c,ply,pt);

Also, be sure you don't have stray shared libraries left around from a previous
(beta) releases like in /usr/local/lib - that would cause crashes.

-- 
Justin


More information about the postgis-devel mailing list