[postgis-devel] [PostGIS] #210: segmentation faults in lwgeom_geos.c:pgis_union_geometry_array

PostGIS trac at osgeo.org
Wed Jun 24 15:44:30 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.3.7
 Component:  postgis    |     Version:  trunk        
Resolution:             |    Keywords:               
------------------------+---------------------------------------------------
Comment (by dfuhriman):

 OK, after playing with it yet more, I can reliably get a segfault every
 third time I run just this select:

 {{{
 create table foo (id serial primary key);
 select addGeometryColumn('', 'foo', 'the_geom', 4326,'MULTIPOLYGON', 2);
 insert into foo (the_geom) VALUES (NULL);
 select  st_numgeometries(ST_Union(the_geom)) from foo;
 }}}

 I played with the debugger a bit, although I can't say I really know how
 to interpret what I'm seeing, not know the guts of postgres and postgis.

 But for instance, I ran the above select three times.

 pgis_union_geometry_array  returns to finalize_aggregate (in postgres
 code), which calls datumCopy on the returned value. dataCopy in turn calls
 datumGetSize, which on the first two tries always returns 0, which seems
 right (the geom being null and all), but on the third go through,
 datumGetSize returns a wildly wrong number of 90135632, where upon the
 SEGV happens on the immediately following palloc().

 The strange thing is, it doesn't just *seem* to happen once every three
 times, the SEGV happens *every* third time I run it.

 Anyway, I hope this helps you guys track it down...

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/210#comment:7>
PostGIS <http://trac.osgeo.org/postgis/>
PostGIS


More information about the postgis-devel mailing list