Opened 2 years ago

Closed 2 years ago

#5050 closed defect (fixed)

TopoGeo_AddPolygon() make postgres instance crash

Reported by: wimned Owned by: strk
Priority: medium Milestone: PostGIS GEOS
Component: topology Version: 3.1.x
Keywords: Cc:

Description

Adding a polygon results the postgres cluster to be crashed. Raising an exception would be expected, not a crash.

Error message:

NOTICE:  Corrupted topology: face 2 could not be constructed only from edges knowing about it (like edge 24).
server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.
connection to server was lost

I attached a short script building op a topology with edges. Two of the edges 'lay very close' to each other. Adding a polygon, with ring also partly overlapping these edges, results in the crash

I attached the polygon and edge data in geojson files.

Version info:

---------------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 12.9 (Ubuntu 12.9-2.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, 64-bit
(1 row)

            postgis_version            
---------------------------------------
 3.1 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
(1 row)

Could be problems are already solved in newer versions, this input could be added to the regression tests.

Attachments (4)

tt.sh (1.3 KB ) - added by wimned 2 years ago.
edges.geojson (6.7 KB ) - added by wimned 2 years ago.
bad_pol.geojson (6.4 KB ) - added by wimned 2 years ago.
topo.png (17.3 KB ) - added by strk 2 years ago.

Download all attachments as: .zip

Change History (11)

by wimned, 2 years ago

Attachment: tt.sh added

by wimned, 2 years ago

Attachment: edges.geojson added

by wimned, 2 years ago

Attachment: bad_pol.geojson added

comment:1 by strk, 2 years ago

Can you please report output of SELECT postgis_full_version() ?

by strk, 2 years ago

Attachment: topo.png added

comment:2 by strk, 2 years ago

Your test does not crash with POSTGIS="3.3.0dev 3.2.0-129-g5c86e1152" [EXTENSION] PGSQL="120" GEOS="3.11.0dev-CAPI-1.16.0" PROJ="7.2.1" LIBXML="2.9.10" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)" TOPOLOGY:

NOTICE:  Corrupted topology: face 2 could not be constructed only from edges knowing about it (like edge 24).
 topogeo_addpolygon
--------------------
                  1
                  6
                  7
                  5
                  3
                  4
                  7
                  9
                 10
(9 rows)

Resulting topology:

comment:3 by wimned, 2 years ago

POSTGIS="3.1.4 ded6c34" [EXTENSION] PGSQL="120" GEOS="3.8.0-CAPI-1.13.1 " PROJ="6.3.1" LIBXML="2.9.10" LIBJSON="0.13.1" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)" TOPOLOGY (1 row)

Soon we'll try a newer version on a test machine.

Thanks for the reply

Last edited 2 years ago by wimned (previous) (diff)

comment:4 by strk, 2 years ago

I just tried with latest version in 3.1 branch: POSTGIS="3.1.5dev 3.1.4-23-g002a55f46" [EXTENSION] PGSQL="120" GEOS="3.11.0dev-CAPI-1.16.0" PROJ="7.2.1" LIBXML="2.9.10" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)" TOPOLOGY and still cannot reproduce.

The NEWS file of PostGIS doesn't mention any specific change from 3.1.4:

  • Bug Fixes
    • #4994, Random missing INSERT in shp2pgsql (Sandro Santilli)
    • #5016, loader (shp2pgsq): Respect LDFLAGS (Greg Troxel)
    • #5018, pgsql2shp basic support for WITH CTE clause (Regina Obe)
    • #5026, fix DropTopology in presence of UPDATE triggers on

topology layers (Sandro Santilli)

  • #5033, #5035, allow upgrades in presence of views using deprecated

functions (Sandro Santilli)

Any chance you have more info in the PostgreSQL log about the crash ? Even better, a core dump ?

Last edited 2 years ago by strk (previous) (diff)

comment:5 by wimned, 2 years ago

Could indeed be a postgres issue. We tried with these versions of postgres and postgis

                                                            version                                                              
----------------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 12.7 (Ubuntu 12.7-1.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, 64-bit
(1 row)

                                                        postgis_full_version                                                         
-------------------------------------------------------------------------------------------------------------------------------------
 POSTGIS="3.3.0dev 7e294a6" [EXTENSION] PGSQL="120" GEOS="3.8.0-CAPI-1.13.1 " PROJ="6.3.1" LIBXML="2.9.10" LIBJSON="0.13.1" TOPOLOGY
(1 row)

, still loosing connection:

                     6
(31 rows)

NOTICE:  Corrupted topology: face 2 could not be constructed only from edges knowing about it (like edge 24).
server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.
connection to server was lost

comment:6 by wimned, 2 years ago

The problem proved to be in the GEOS module. Trying out with geos 3.10 in a virtual box gave no problems. We are now looking how to update our production systems without dependency problems.

comment:7 by robe, 2 years ago

Milestone: PostGIS 3.1.5PostGIS GEOS
Resolution: fixed
Status: newclosed

I'm gonna guess this is fixed in GEOS 3.8.3 but don't have that readily handy at moment.

Note: See TracTickets for help on using tickets.