[postgis-devel] [PostGIS] #210: segmentation faults in lwgeom_geos.c:pgis_union_geometry_array
PostGIS
trac at osgeo.org
Wed Jun 24 09:58:17 PDT 2009
#210: segmentation faults in lwgeom_geos.c:pgis_union_geometry_array
-----------------------+----------------------------------------------------
Reporter: dfuhriman | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: postgis 1.4.0
Component: postgis | Version:
Keywords: |
-----------------------+----------------------------------------------------
Using SVN at revision r4190 with GEOS 3.1.0 and PROJ 4.6.0
In a couple different cases, I've come across a bug that causes a
segmentation fault in the server. It seems to happen when a NULL geometry
is passed into the ST_Union(function), but I could be wrong about that.
The following query should trip the bug when using the attached data.
Replacing the LEFT OUTER JOIN with a simple JOIN works fine (most likely
because there is no intersection) between the geometries. FWIW, this query
does work with 1.3.6 (built, I believe, against the 3.0.x GEOS line, but
also using PROJ 4.6.0).
{{{
SELECT T1.gid as taxlot_id,
coalesce(sqft_of(ST_Union(B2.the_geom)),
sqft_of(ST_Union(ST_Intersection(T1.the_geom,B1.the_geom)))
) as roof_area_sqft
INTO TABLE example
FROM test.T1 as T1
-- JOIN test.B2 as B2 on
(st_within(B2.the_geom_centroids,T1.the_geom))
-- JOIN test.B1 as B1 on (st_intersects(T1.the_geom, B1.the_geom))
LEFT OUTER JOIN test.B2 as B2 on
(st_within(B2.the_geom_centroids,T1.the_geom))
LEFT OUTER JOIN test.B1 as B1 on (st_intersects(T1.the_geom,
B1.the_geom))
where T1.gid = 1
GROUP by T1.gid;
}}}
the sqft_of() function is just a convenience function defined as:
{{{
create or replace function sqft_of(geometry) returns integer as $$
select
CASE
WHEN cast(round(ST_Area(ST_Transform($1,102008))*10.76391) as
integer) > 0
THEN cast(round(ST_Area(ST_Transform($1,102008))*10.76391) as
integer)
ELSE NULL
END
$$ language 'sql' STRICT IMMUTABLE;
}}}
(I'm a bit confused about why it's even getting called at all since it's
defined as STRICT, and it does seem to get a NULL geometry, but that's a
different question.)
Debugging output follows:
{{{
NOTICE: [lwgeom_estimate.c:LWGEOM_gist_joinsel:198] LWGEOM_gist_joinsel
called with jointype 1
NOTICE: LWGEOM_gist_joinsel called with incorrect join type
NOTICE: [lwgeom_estimate.c:LWGEOM_gist_joinsel:198] LWGEOM_gist_joinsel
called with jointype 1
NOTICE: LWGEOM_gist_joinsel called with incorrect join type
NOTICE: [lwgeom_gist.c:LWGEOM_overlap:98] GIST: LWGEOM_overlap --entry
NOTICE: [lwgeom_api.c:getbox2d_p:423] getbox2d_p call
NOTICE: [lwgeom_api.c:getbox2d_p:430] getbox2d_p: has box
NOTICE: [lwgeom_api.c:getbox2d_p:423] getbox2d_p call
NOTICE: [lwgeom_api.c:getbox2d_p:430] getbox2d_p: has box
NOTICE: [lwgeom_gist.c:LWGEOM_overlap:126] GIST: lwgeom_overlap:
(-122.667847 45.497169, -122.661789 45.497169) (-122.642586 45.457573
-122.640732 45.457573) = 0
NOTICE: [lwgeom_gist.c:LWGEOM_overlap:98] GIST: LWGEOM_overlap --entry
NOTICE: [lwgeom_api.c:getbox2d_p:423] getbox2d_p call
NOTICE: [lwgeom_api.c:getbox2d_p:435] getbox2d_p: has no box - computing
NOTICE: [lwgeom_api.c:lwgeom_getType:853] lwgeom_getType 65
NOTICE: [lwgeom_api.c:compute_serialized_box3d:1669]
compute_serialized_box3d called on type 1
NOTICE: [lwpoint.c:lwpoint_deserialize:253] lwpoint_deserialize called
NOTICE: [lwgeom_api.c:lwgeom_getType:853] lwgeom_getType 65
NOTICE: [lwpoint.c:lwpoint_deserialize:284] lwpoint_deserialize: input
has SRID
NOTICE: [lwgeom_api.c:pointArray_construct:788] pointArray_construct
called.
NOTICE: [lwgeom_api.c:pointArray_construct:798] pointArray_construct
returning 0x33c4e10
NOTICE: [lwgeom_api.c:compute_serialized_box3d:1687]
compute_serialized_box3d: lwpoint deserialized
NOTICE: [lwpoint.c:lwpoint_compute_box3d:98] lwpoint_compute_box3d called
with point 0x33c4de0
NOTICE: [lwpoint.c:lwpoint_compute_box3d:107] lwpoint_compute_box3d
returning ptarray_compute_box3d return
NOTICE: [ptarray.c:ptarray_compute_box3d_p:408] ptarray_compute_box3d
call (array has 1 points)
NOTICE: [lwgeom_api.c:getPoint3dz_p:582] getPoint3dz_p called on array of
2-dimensions / 1 pts
NOTICE: [lwgeom_api.c:pointArray_ptsize:811] pointArray_ptsize:
TYPE_NDIMS(pa->dims)=2
NOTICE: [ptarray.c:ptarray_compute_box3d_p:414] got point 0
NOTICE: [ptarray.c:ptarray_compute_box3d_p:432] scanning other 1 points
NOTICE: [ptarray.c:ptarray_compute_box3d_p:449] returning box
NOTICE: [lwgeom_api.c:compute_serialized_box3d:1691]
compute_serialized_box3d: bbox found
NOTICE: [lwgeom_api.c:getbox2d_p:440] getbox2d_p:
compute_serialized_box3d returned 0x33816d0
NOTICE: [lwgeom_api.c:getbox2d_p:444] getbox2d_p: box3d converted to
box2d
NOTICE: [lwgeom_api.c:getbox2d_p:423] getbox2d_p call
NOTICE: [lwgeom_api.c:getbox2d_p:430] getbox2d_p: has box
NOTICE: [lwgeom_gist.c:LWGEOM_overlap:126] GIST: lwgeom_overlap:
(-122.687775 45.531441, -122.687767 45.531441) (-122.667847 45.497169
-122.661789 45.497169) = 0
NOTICE: [lwgeom_geos.c:pgis_union_geometry_array:119] GEOS incremental
union (call 2)
NOTICE: [lwgeom_geos.c:pgis_union_geometry_array:131] unite_garray:
number of elements: 1
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Succeeded.
}}}
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/210>
PostGIS <http://trac.osgeo.org/postgis/>
PostGIS
More information about the postgis-devel
mailing list