#3416 closed defect (fixed)
topology: crash when loading topogeometry (regression)
Reported by: | rulus | Owned by: | pramsey |
---|---|---|---|
Priority: | blocker | Milestone: | PostGIS 2.2.1 |
Component: | postgis | Version: | 2.2.x |
Keywords: | Cc: |
Description
Recent versions of the 2.2 branch fail to load (some?) topogeometries; using the toTopoGeom function leads to a database crash.
Using gdb I got this backtrace:
Program received signal SIGSEGV, Segmentation fault. _box2d_to_hexwkb (bbox=bbox@entry=0x99, srid=31370) at postgis_topology.c:126 126 p.x = bbox->xmin; (gdb) bt #0 _box2d_to_hexwkb (bbox=bbox@entry=0x99, srid=31370) at postgis_topology.c:126 #1 0x00007efe26269757 in cb_getEdgeByFace (topo=0x55e7c0fa68d0, ids=0x7ffd4e19c098, numelems=0x7ffd4e19c0a4, fields=153, box=0x99) at postgis_topology.c:914 #2 0x00007efe2792f115 in ?? () from /usr/lib/liblwgeom-2.2.so.2 #3 0x00007efe279307bf in ?? () from /usr/lib/liblwgeom-2.2.so.2 #4 0x00007efe27935e88 in lwt_AddLine () from /usr/lib/liblwgeom-2.2.so.2 #5 0x00007efe27936642 in lwt_AddPolygon () from /usr/lib/liblwgeom-2.2.so.2 #6 0x00007efe2626fbc5 in TopoGeo_AddPolygon (fcinfo=0x55e7c0f9f7e0) at postgis_topology.c:4426 #7 0x000055e7c022e496 in ?? () #8 0x000055e7c0230e6d in ExecProject () #9 0x000055e7c0243568 in ExecResult () #10 0x000055e7c0229d18 in ExecProcNode () #11 0x000055e7c0226f5e in standard_ExecutorRun () #12 0x000055e7c0321247 in ?? () #13 0x000055e7c0322bc0 in PortalRunFetch () #14 0x000055e7c024b6bd in ?? () #15 0x00007efe3b597b6b in ?? () from /usr/lib/postgresql/9.4/lib/plpgsql.so #16 0x00007efe3b5943f3 in ?? () from /usr/lib/postgresql/9.4/lib/plpgsql.so #17 0x00007efe3b597bf1 in ?? () from /usr/lib/postgresql/9.4/lib/plpgsql.so #18 0x00007efe3b5943f3 in ?? () from /usr/lib/postgresql/9.4/lib/plpgsql.so #19 0x00007efe3b596aad in ?? () from /usr/lib/postgresql/9.4/lib/plpgsql.so #20 0x00007efe3b596cd2 in plpgsql_exec_function () from /usr/lib/postgresql/9.4/lib/plpgsql.so #21 0x00007efe3b58bd49 in plpgsql_call_handler () from /usr/lib/postgresql/9.4/lib/plpgsql.so #22 0x000055e7c022ae83 in ?? () #23 0x00007efe3b590cb4 in ?? () from /usr/lib/postgresql/9.4/lib/plpgsql.so #24 0x00007efe3b5922c9 in ?? () from /usr/lib/postgresql/9.4/lib/plpgsql.so #25 0x00007efe3b594731 in ?? () from /usr/lib/postgresql/9.4/lib/plpgsql.so #26 0x00007efe3b596aad in ?? () from /usr/lib/postgresql/9.4/lib/plpgsql.so #27 0x00007efe3b596cd2 in plpgsql_exec_function () from /usr/lib/postgresql/9.4/lib/plpgsql.so #28 0x00007efe3b58bd49 in plpgsql_call_handler () from /usr/lib/postgresql/9.4/lib/plpgsql.so #29 0x000055e7c022ae83 in ?? () #30 0x000055e7c0230e6d in ExecProject () #31 0x000055e7c0231281 in ExecScan () #32 0x000055e7c0229cc8 in ExecProcNode () #33 0x000055e7c0231228 in ExecScan () #34 0x000055e7c0229c78 in ExecProcNode () #35 0x000055e7c02409b9 in ExecModifyTable () #36 0x000055e7c0229d08 in ExecProcNode () #37 0x000055e7c0226f5e in standard_ExecutorRun () #38 0x000055e7c03218c8 in ?? () #39 0x000055e7c0321b00 in ?? () #40 0x000055e7c0322734 in PortalRun () #41 0x000055e7c031f4e3 in PostgresMain () #42 0x000055e7c00e8773 in ?? () #43 0x000055e7c02c950a in PostmasterMain () #44 0x000055e7c00e990c in main ()
The issue is introduced in r14226 (found using git bisect), which relates to ticket #3321.
Last working version in the 2.2 branch is: PostgreSQL 9.4.5 on x86_64-unknown-linux-gnu, compiled by gcc (Debian 5.2.1-23) 5.2.1 20151028, 64-bit "POSTGIS="2.2.1dev r14218" GEOS="3.5.0-CAPI-1.9.0 r4084" PROJ="Rel. 4.9.2, 08 September 2015" GDAL="GDAL 2.0.1, released 2015/09/15" LIBXML="2.9.3" LIBJSON="0.11.99" TOPOLOGY RASTER
Change History (15)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Your backtrace looks like a mismatch between the client code and the library code (ie: unhandled ABI change) -- did you start from a clean build ?
comment:3 by , 9 years ago
I tried starting from a clean build, maybe something went wrong there. I'll retry completely from scratch now.
This triggers the crash for me (on an empty database):
create extension postgis; create extension postgis_topology; create table grondwaterlichamen ( id serial primary key, naam varchar ); select createtopology('gwl', 31370, 0.01); select topology.AddTopoGeometryColumn('gwl', 'public', 'grondwaterlichamen', 'topogeom', 'MULTIPOLYGON'); insert into grondwaterlichamen (naam, topogeom) select 'test', topology.toTopoGeom(st_geomfromewkt('SRID=31370;POLYGON((30 10, 40 40, 20 40, 10 20, 30 10))'), 'gwl', 1, 0.01);
comment:4 by , 9 years ago
Recompiling from a new copy of the source didn't resolve the issue; maybe some files of the previous version still remain on my system? I'm not sure how to get rid of them.
Can you maybe give me a hint on how to do a completely new build? What I currently do is
sudo make uninstall make clean ./autogen.sh ./configure --enable-debug make sudo make install sudo ldconfig
comment:5 by , 9 years ago
if you're building from git you might want to try {{ git clean -fX }}
anyway, if you can provide the data to reproduce this i'll be happy to try it out
comment:6 by , 9 years ago
Thanks! It really fails with the simplest geometry here (see testcase in comment 3).
comment:7 by , 9 years ago
No crash here:
t3416=# create extension postgis; CREATE EXTENSION t3416=# create extension postgis_topology; CREATE EXTENSION t3416=# t3416=# create table grondwaterlichamen ( t3416(# id serial primary key, t3416(# naam varchar t3416(# ); CREATE TABLE t3416=# t3416=# select createtopology('gwl', 31370, 0.01); createtopology ---------------- 1 (1 row) t3416=# select topology.AddTopoGeometryColumn('gwl', 'public', 'grondwaterlichamen', 'topogeom', 'MULTIPOLYGON'); addtopogeometrycolumn ----------------------- 1 (1 row) t3416=# t3416=# insert into grondwaterlichamen (naam, topogeom) t3416-# select 'test', topology.toTopoGeom(st_geomfromewkt('SRID=31370;POLYGON((30 10, 40 40, 20 40, 10 20, 30 10))'), 'gwl', 1, 0.01); INSERT 0 1 t3416=# select postgis_full_version(); postgis_full_version ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- POSTGIS="2.2.1dev r14534" GEOS="3.4.0dev-CAPI-1.8.0 r4137" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.11.1, released 2014/09/24" LIBXML="2.9.1" LIBJSON="0.12" TOPOLOGY RASTER (1 row)
What does your "postgis_full_version()" output say
comment:8 by , 9 years ago
My current version string is: POSTGIS="2.2.1dev r14534" GEOS="3.5.0-CAPI-1.9.0 r4084" PROJ="Rel. 4.9.2, 08 September 2015" GDAL="GDAL 2.0.1, released 2015/09/15" LIBXML="2.9.3" LIBJSON="0.11.99" TOPOLOGY RASTER
But as you mentioned I might have mixed up different revisions/builds on my system here..
comment:10 by , 9 years ago
Priority: | medium → blocker |
---|
comment:11 by , 9 years ago
I could reproduce, --enable-debug is what makes a difference. I'm on it.
comment:12 by , 9 years ago
Thanks! Without the --enable-debug, no crash here either. Good catch!
Output of version is: PostgreSQL 9.4.5 on x86_64-unknown-linux-gnu, compiled by gcc (Debian 5.2.1-23) 5.2.1 20151028, 64-bit
comment:13 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Can you share a small testcase to reproduce the problem ?