Opened 16 years ago
Last modified 15 years ago
#112 closed defect
ST_CurveToLine sometimes crashes server — at Version 8
Reported by: | robe | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 1.4.0 |
Component: | postgis | Version: | 1.3.X |
Keywords: | Cc: |
Description (last modified by )
What steps will reproduce the problem? 1.
SELECT 'ST_CurveToLine GCSet3D: Start Testing GEOMETRYCOLLECTION';
BEGIN; SELECT ST_AsEWKT(ST_CurveToLine(foo1.the_geom))
FROM ((SELECT
ST_Collect(ST_Collect(ST_SetSRID(ST_MakePoint(i,j,m),4326),ST_SetSRID(ST_MakePolygon(ST_AddPoint(ST_AddPoint(ST_MakeLine(ST_MakePoint(i+m,j,m),ST_MakePoint(j+m,i-m,m)),ST_MakePoint(i,j,m)),ST_MakePointM(i+m,j,m))),4326)))
As the_geom
FROM generate_series(-10,50,20) As i
CROSS JOIN generate_series(50,70, 20) As j CROSS JOIN generate_series(1,2) As m GROUP BY m)) As foo1;
COMMIT; SELECT 'ST_CurveToLine GCSet3D: End Testing GEOMETRYCOLLECTION';
What is the expected output? It should do nothing and just return what I input since input contains no curves.
What do you see instead? psql:torturetest.sql:157312: server closed the connection unexpectedly
This probably means the server terminated abnormally before or while processing the request.
psql:torturetest.sql:157312: connection to server was lost
Haven't test on 1.3 but assume same issue exists
Change History (8)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Distilled the test case down to:
SELECT ST_CurveToLine('GEOMETRYCOLLECTION(POINT(-10 50))'::geometry);
Effects both 1.3 branch and trunk.
comment:3 by , 16 years ago
Arrgh! I've worked out what's happening here: basically pglwgeom_serialize() alters its input geometry which should be a total no-no. The fix should be to remove this horrible piece of code from pglwgeom_serialize:
#if POSTGIS_AUTOCACHE_BBOX
if ( ! in->bbox && is_worth_caching_lwgeom_bbox(in) ) {
lwgeom_addBBOX(in);
}
#endif
and then go around the rest of the codebase fixing up any callers that require it.
ATB,
Mark.
comment:5 by , 16 years ago
I renabled this test in torture script and doesn't seem to crash anymore. Haven't tested on 1.3 though. I'll test that tomorrow.
comment:8 by , 16 years ago
Description: | modified (diff) |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
Well I haven't tested this on 1.3.6 but crashes server on 1.3.5 production and 1.4.0 SVN (at least on Windows).
SELECT ST_CurveToLine(ST_GeomFromText('CIRCULARSTRING(4 4,4 5,4 8)'))
Here's the preliminary backtrace:
(gdb) bt #0 0x000000000067c68a in pfree () #1 0x00007ffa773e502b in lwgeom_release (lwgeom=0xb7f420) at lwgeom.c:332 #2 0x00007ffa773df079 in LWGEOM_curve_segmentize () from /home/pg83/rel-8.3.5/lib/postgresql/postgis-1.4.so #3 0x00000000005294bd in ExecMakeFunctionResult () #4 0x0000000000527615 in ExecEvalFuncArgs () #5 0x0000000000529433 in ExecMakeFunctionResult () #6 0x00000000005273ce in ExecProject () #7 0x000000000052d1df in ExecScan () #8 0x00000000005268e8 in ExecProcNode () #9 0x0000000000524905 in ExecutorRun () #10 0x00000000005be5a0 in PortalRunSelect () #11 0x00000000005bfc09 in PortalRun () #12 0x00000000005baeac in exec_simple_query () #13 0x00000000005bc3d7 in PostgresMain () #14 0x00000000005907b2 in ServerLoop () #15 0x0000000000591494 in PostmasterMain () #16 0x0000000000546b48 in main () (gdb) frame 1 #1 0x00007ffa773e502b in lwgeom_release (lwgeom=0xb7f420) at lwgeom.c:332 332 lwfree(lwgeom->bbox); Current language: auto; currently c (gdb)
I suspect it's probably related to some geometries having bboxs and some not...
ATB,
Mark.