[postgis-devel] ST_MaximumInscribedCircle madness

Rémi Cura remi.cura at gmail.com
Thu Apr 20 14:38:17 PDT 2023


Hello dear Postgis devs!

I have a strange case to submit to you.
In a nutshell, trying to compute
```SQL
SELECT ST_MaximumInscribedCircle( 'POLYGON ((59.3 100.00000000000001, 99.7
100.00000000000001, 99.7 100, 59.3 100, 59.3 100.00000000000001))') ;
```
causes it to run for many minutes until it eventually errors.
Worst, running this kind of computing on 12M geoms in parallel x6 created a
postgres **segfault** and crashed my server (16 cores, 64GB).
(many more geoms are making this function unhappy).

/!\ Once this query starts, it can't be stopped by `pg_cancel_backend(pid)`
or even `pg_terminate_backend(pid)`
--> This is pretty dangerous in my opinion.


The geometry is simple, it is a rectangle.
I obtained it through other geometry operations
It must be some kind of precision issue, I'm wondering if there is some
kind of infinite loop going on or something.

My full code is something like that:
```SQL
SELECT env, diff, ST_MaximumInscribedCircle(diff)
FROM CAST ('some_polygon'as text ) as g
    , ST_Envelope(g) as env
    , ST_MakeEnvelope(0,0,100,100) as bound
    , ST_Difference(env, bound) as diff;
```

Not creating a bug ticket as I don't know if I'm simply abusing the
function / using it in a way it should not.


POSTGIS="3.1.7 aafe1ff" [EXTENSION] PGSQL="140" GEOS="3.9.1-CAPI-1.14.2"
PROJ="8.0.1" GDAL="GDAL 3.4.3, released 2022/04/22" LIBXML="2.9.1"
LIBJSON="0.15" LIBPROTOBUF="1.3.2" WAGYU="0.5.0 (Internal)" RASTER

PostgreSQL 14.7 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 7.3.1
20180712 (Red Hat 7.3.1-12), 64-bit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20230420/77b4e1e5/attachment.htm>


More information about the postgis-devel mailing list