Opened 8 years ago

Closed 2 years ago

#1029 closed defect (fixed)

geometric object crashes server with Out Of Memory

Reported by: cousinm Owned by: pramsey
Priority: medium Milestone: PostGIS GEOS
Component: postgis Version: 1.5.X
Keywords: Cc: cousinm, mtnclimb@…, strk

Description

The attached object crashes the PostgreSQL server after allocating more than 20 Gigabytes of ram (sometimes bringing the server with it), when using any GIS function even st_isvalid().

I don't know if it is valid, it was provided «as is» by a user, and I can't run st_isvalid() on it.

SELECT postgis_full_version();

postgis_full_version


POSTGIS="1.5.2" GEOS="3.2.2-CAPI-1.6.2" PROJ="Rel. 4.7.1, 23 September 2009" LIBXML="2.7.8" USE_STATS

(1 row)

The attached script creates a «test» table, and puts this object inside it.

Please tell me if I can provide anything to help on this problem.

Attachments (1)

geom_test.sql.gz (653.6 KB) - added by cousinm 8 years ago.
script creating test data

Download all attachments as: .zip

Change History (12)

Changed 8 years ago by cousinm

Attachment: geom_test.sql.gz added

script creating test data

comment:1 Changed 8 years ago by robe

I suspect you are experiencing the GEOS bug described in #1007. The fix is to upgrade to GEOS 3.3.0 or GEOS 3.2.3.

Please give that a try and let us know how that works.

comment:2 Changed 8 years ago by robe

It would also help if you printed out the

SELECT version();

comment:3 Changed 8 years ago by cousinm

SELECT version();

version


PostgreSQL 9.0.4 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.6.0 20110415 (prerelease), 64-bit

(1 row)

I'm going to try with a newer GEOS.

comment:4 Changed 8 years ago by robe

Sorry I forgot 3.3.0 is already released so the fixed GEOS are 3.2.3SVN and 3.3.1SVN

comment:5 Changed 8 years ago by cousinm

I have the same problem using 3.3.1SVN.

comment:6 Changed 8 years ago by cousinm

Cc: cousinm added

comment:7 Changed 8 years ago by pramsey

Cc: mtnclimb@… strk added

Confirmed, same behaviour on GEOS 3.2.3 under OS/X. Other pure-PostGIS functions work, but building the edge graph in GEOS leads to memory explosion.

comment:8 Changed 8 years ago by pramsey

From Martin:

This geometry causes problems in JTS as well (all versions). The problem is that there is an area of the geometry where there are about 2000 circular polygons (totalling about 71000 pts) which are all *almost* identical. This causes the noding algorithm to have a hissy fit.

It should be possible to get validation working at least, since the geometry is obviously invalid (due to the numerous overlaps).

Also, Unary Union works fine, with respectable performance. So if it's necessary to reduce the polygon to something workable, that's the way to do it.

comment:9 Changed 8 years ago by pramsey

Milestone: PostGIS 1.5.3PostGIS 1.5.4

comment:10 Changed 8 years ago by pramsey

Milestone: PostGIS 1.5.4PostGIS GEOS

comment:11 Changed 2 years ago by pramsey

Resolution: fixed
Status: newclosed

Times have changed, latest GEOS seems to handle this fine

postgis25=# select st_isvalid(the_geom) from test ;
NOTICE:  Self-intersection at or near point 2.8991599328317328 50.534034807793205
 st_isvalid 
------------
 f
(1 row)
 POSTGIS="2.5.0dev r15870" PGSQL="100" GEOS="3.7.0dev-CAPI-1.11.0 1618346" PROJ="Rel. 4.9.1, 04 March 2015" LIBXML="2.9.2" LIBJSON="0.12" LIBPROTOBUF="1.1.0"
Note: See TracTickets for help on using tickets.