Opened 4 years ago

Closed 4 years ago

#1036 closed defect (fixed)

GeomDifference with Overlay turned on goes into infinite look in PostGIS ST_WrapX

Reported by: robe Owned by: geos-devel@…
Priority: blocker Milestone: 3.9.0
Component: Default Version: main
Severity: Unassigned Keywords:
Cc:

Description (last modified by robe)

This is related to https://trac.osgeo.org/postgis/ticket/4731. Which after much input has been determined to be an issue with the new GEOS 3.9 overlay logic.

The crashing example in PostGIS

SELECT ST_WrapX('LINESTRING(-11.1111111 70,70 -11.1111111)'::geometry, 20.1,20.1);

Related IRC discussion

15:30:30	Algunenano:	ReginaObe[m]: WrapX uses split by line, which uses GEOSUnion
15:30:39	Algunenano:	Maybe it's that?
15:30:57	ReginaObe[m]:	ah Algunenano so I guess we got to update the docs too to reflect it uses GEOS
15:31:14	ReginaObe[m]:	who would have thunk it :)
15:31:37	PaulRamsey[m]:	you have a winner, it crashed for me too
15:31:42	ReginaObe[m]:	Paul Ramsey: well that's a crasher
15:33:19	PaulRamsey[m]:	It does eventually call GEOSDifference
15:33:28	PaulRamsey[m]:	after 25000 frames of recursion?
15:33:41	PaulRamsey[m]:	I mean, something non-geos broken in there?
15:33:48	PaulRamsey[m]:	weird
15:36:20	PaulRamsey[m]:	probably in ` split = lwgeom_split(geom_in, blade);`
15:36:34	Algunenano:	It looks like an infinite loop. Has the geometry type changed? Maybe line -> multiline?
15:38:35	Algunenano:	It seems that, for some reason, lwgeom_split_wrapx calls lwcollection_wrapx over the result, so it it returns a multiline (with a single line) it might be going to infinity and beyond
15:39:34	PaulRamsey[m]:	yeah, not sure why it tries to wrap the components of the split...
15:39:50	PaulRamsey[m]:	but if the components were slightly shifted, like enough to hit the blade again
15:39:57	PaulRamsey[m]:	it would split over and over and over
15:45:54	ReginaObe[m]:	Hmm ST_Split also doesn't note dependency on GEOS
15:46:09	ReginaObe[m]:	which version of GEOS are required for these
15:46:35	PaulRamsey[m]:	it uses difference, so pretty much all of them
15:47:06	PaulRamsey[m]:	once martin implements a splitter over the new overlay all the splitting code can get simpler and more reliable.. right now it's a hack on difference
15:49:35	PaulRamsey[m]:	found it, @algunano
15:49:35	PaulRamsey[m]:	found it, @algunano

select st_astext(st_difference('LINESTRING(-11.1111111 70,70 -11.1111111)'::geometry, 'LINESTRING (20.1 90, 20.1 -90)'::geometry));
                         st_astext                         
-----------------------------------------------------------
 LINESTRING(-11.1111111 70,20.1 38.7888889,70 -11.1111111)
(1 row)

From related PostGIS ticket


The lwgeom_split_wrapx function expects a split (which under the covers is a difference of a line away from an input) to return a collection, which it then iterates on. Instead we hand it a unitary object... which it then goes and tries to split again. Hence the infinite recursion. We need probably the old behaviour back, so that a GEOS 3.9 install doesn't break older software.

Change History (3)

comment:1 by robe, 4 years ago

Description: modified (diff)

comment:2 by pramsey, 4 years ago

Check against current master, this should be gone now.

comment:3 by robe, 4 years ago

Resolution: fixed
Status: newclosed

yap no more crashing.

Note: See TracTickets for help on using tickets.