[postgis-tickets] [PostGIS] #3720: geobuf regress error on debbie and winnie

PostGIS trac at osgeo.org
Sun Mar 5 04:00:28 PST 2017


#3720: geobuf regress error on debbie and winnie
----------------------+----------------------------
  Reporter:  robe     |      Owner:  Björn Harrtell
      Type:  defect   |     Status:  new
  Priority:  medium   |  Milestone:  PostGIS 2.4.0
 Component:  postgis  |    Version:  2.3.x
Resolution:           |   Keywords:
----------------------+----------------------------

Comment (by Björn Harrtell):

 I'll have to learn valgrind sometime. And get better at writing unit
 testable C code. In the meantime I've pinpointed the problem. Because of
 the nature of Geobuf I need to analyze all input geometries and encode
 them as the final aggregation step based on the max precision found when
 analyzing. So I save LWGEOM instances from lwgeom_from_gserialized in each
 aggregation step and it seems it the memory allocated in this process is
 going out of scope before the final aggregation step. I don't understand
 why it only manifest itself on geometries with multiple rings, and how the
 output can be perfectly consistent.

 The problem disappears if I make a lwgeom_clone_deep before saving it in
 the aggregation context. This is surprising to me as it uses the exact
 same allocation method as the lwgeom_from_gserialized function. I'm not
 really happy with this fix so I'll keep looking into this issue.

 It's possible I'm doing something wrong regarding the MemoryContext
 handling that is important in aggregration functions but I can't I
 understand it fully.

--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3720#comment:27>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list