Opened 7 years ago
Closed 7 years ago
#4058 closed defect (fixed)
st_curvetoline hangs forever
Reported by: | mjurce | Owned by: | strk |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 2.4.5 |
Component: | postgis | Version: | 2.4.x |
Keywords: | Cc: |
Description
Trying to convert the geom in attachment out.txt to linear with precision 0.001 it works very fast, but the same geom with precision 0.0001 it hangs forever attached file out2.txt.
Postgis version:
OSTGIS="2.4.3 r16312" PGSQL="100" GEOS="3.6.2-CAPI-1.10.2 4d2925d6" PROJ="Rel. 4.9.2, 08 September 2015" GDAL=" GDAL 1.11.0, released 2014/04/16" LIBXML="2.9.3" RASTER
Attachments (2)
Change History (15)
by , 7 years ago
by , 7 years ago
comment:1 by , 7 years ago
Summary: | st_curvetoline hangs forvever → st_curvetoline hangs forever |
---|
comment:2 by , 7 years ago
Milestone: | PostGIS 2.4.4 → PostGIS 2.5.0 |
---|
comment:3 by , 7 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 7 years ago
comment:5 by , 7 years ago
Reduced testcase:
select st_npoints(ST_CurveToLine( 'CIRCULARSTRING(2696000.55.831999999936670, 2695950.552000000141561 1125749.833000000100583, 2695865.195999999996275 1125835.189000)' ::geometry, 0.0001, 1, 0))
comment:6 by , 7 years ago
strk which version of geos/postgis are you using?
Your reduced test case does not hang for me:
POSTGIS="2.5.0alpha r16593" [EXTENSION] PGSQL="110" GEOS="3.7.0dev-CAPI-1.11.0 3fe3c03" PROJ="Rel. 4.9.3, 15 August 2016" GDAL="GDAL 2.2.4, released 2018/03/19" LIBXML="2.7.8" LIBJSON="0.12" LIBPROTOBUF="1.2.1" RASTER
select st_npoints(ST_CurveToLine( 'CIRCULARSTRING(2696000.55.831999999936670, 2695950.552000000141561 1125749.833000000100583, 2695865.195999999996275 1125835.189000)' ::geometry, 0.0001, 1, 0))
returns - 49551
comment:7 by , 7 years ago
With the attached output2.txt (output.txt is fine) it does hang indefinitely, so I don't think your reduced test case is sufficient to replicate the issue.
comment:8 by , 7 years ago
Milestone: | PostGIS 2.5.0 → PostGIS 2.4.5 |
---|
comment:9 by , 7 years ago
It is sufficient here, so it must be related to compiler (how much optimization is done)
What happens is that increment is 0 OR angle+increment results in the same angle over and over again
comment:10 by , 7 years ago
Ops, sorry I cannot actually reproduce anymore today so I must have pasted the wrong clipboard, will try again later
comment:11 by , 7 years ago
Ok my reduced testcase was using a weird syntax (see #4109). This one reproduces the problem for me:
SELECT ST_CurveToLine( 'CIRCULARSTRING(2696000.553 1125699.831999999936670, 2695950.552000000141561 1125749.833000000100583, 2695865.195999999996275 1125835.189000)' ::geometry, 0.0001,1,0);
And note it is NOT interruptible, so only run in a controlled environment
comment:12 by , 7 years ago
Pull request with a fix is ready: https://git.osgeo.org/gitea/postgis/postgis/pulls/25 (only fixes infinite loop, not interruptability)
Confirmed with r16553 - culprit is an arc with a very large radius, resulting in a computed arc angle=0. I guess we'll want these arcs to be rendered with a single segment: