[postgis-devel] Topology Regression Failure

Paul Ramsey pramsey at cleverelephant.ca
Wed Feb 8 10:29:08 PST 2012


I'm pushed some of those calls further down the order, thanks for finding this.
P.

On Wed, Feb 8, 2012 at 1:39 AM, Sandro Santilli <strk at keybit.net> wrote:
> Ok, I found the culprit.
> The problem is wider than what shows up and may require reverting
> commit r9072 or otherwise carefully going trough it.
>
> Basically the issue is calling PG_FREE_IF_COPY too early.
>
> When deserializing geometries we end up having LWGEOM objects
> which still reference the underlying serialized representation.
> PG_FREE_IF_COPY releases that underlying data.
>
> This is still true on lwgeom_clone, which does not do a deep
> cloning (also cloning pointarray). And lwgeom_clone is possibly
> used by liblwgeom functions when they want to return a "copy"
> of the input. This was the case for ST_Split, for example.
>
> Freeing things _after_ serialization is fine.
>
> I've committed a fix for ST_Split with r9095, which is fixing
> the testsuite, but I'd be concerned about other such cases.
>
> It would help if changeset were smaller and more focused.
> The review of lwgeom_free and lwgeom_release didn't need
> moving PG_FREE_IF_COPY around.
>
> --strk;
>
> On Wed, Feb 08, 2012 at 09:46:25AM +0100, Sandro Santilli wrote:
>> On Wed, Feb 08, 2012 at 09:21:18AM +0100, Sandro Santilli wrote:
>> > On Wed, Feb 08, 2012 at 09:05:23AM +0100, Sandro Santilli wrote:
>> > > On Tue, Feb 07, 2012 at 04:32:40PM -0800, Paul Ramsey wrote:
>> > > > Sandro,
>> > > > Something in my cleanup to lwgeom_release
>> > > > (http://trac.osgeo.org/postgis/changeset/9072/trunk) is causing
>> > > > problems in topology...
>> > > >
>> > > >
>> > > > --- regress/st_createtopogeo_expected   2011-11-13 13:55:16.000000000 -0800
>> > > > +++ /var/folders/vQ/vQpcmrOZEXuINbyg+7Jj4k+++TI/-Tmp-//test_17_out
>> > > >  2012-02-07 16:29:46.000000000 -0800
>> > > > @@ -5,16 +5,16 @@
>> > > >  ERROR:  Geometry SRID (0) does not match topology SRID (4326)
>> > > >  T1|POINT(0 0)
>> > > >  T1|1 nodes|0 edges|0 faces
>> > > > -T2|SRID=4326;LINESTRING(0 0,8 -40)
>> > > > -T2|2 nodes|1 edges|0 faces
>> > > > +ERROR:  Invalid edge (no two distinct vertices exist)
>> > > > +T2|0 nodes|0 edges|0 faces
>> > > >  T3|SRID=4326;POLYGON((0 0,8 -40,70 34,0 0))
>> > > >  T3|1 nodes|1 edges|1 faces
>> > > >
>> > > > The problem seems to be in the topology creation, but it doesn't show
>> > > > up directly and I don't know how to trace through and find out what
>> > > > *particular* function has changed its behavior. If you can tell me
>> > > > what function has changed, I can fix it, but at the moment I'm SOL.
>> > >
>> > > Did you check cunit test under valgrind ?
>> >
>> > I just did and it shows a lot of errors in TIN and SURFACE tests,
>> > but nothing about topology. Will inspect further. May be better
>> > NOT to cut next alpha until the regression and memory errors are
>> > fixed.
>>
>> First error I detect with POSTGIS_TOPOLOGY_DEBUG defined is here:
>>
>> Good:
>>  DEBUG:  Split by POINT(36 26): MULTILINESTRING((36 26,38 30))
>>  DEBUG:  Split by POINT(38 30): MULTILINESTRING((36 26,38 30))
>>
>> Bad:
>>  DEBUG:  Split by POINT(36 26): MULTILINESTRING((36 26,38 30))
>>  DEBUG:  Split by POINT(38 30): MULTILINESTRING((4.94065645841247e-324 6.94094528790257e-310,6.94094528790099e-310 38))
>>
>> But doesn't look like the problem is in ST_Split, so there must be
>> some memory corruption before that.
>>
>> --strk;
>>
>>   ,------o-.
>>   |   __/  |    Thank you for PostGIS-2.0 Topology !
>>   |  / 2.0 |    http://www.pledgebank.com/postgistopology
>>   `-o------'
>>
>
> --
>
>  ,------o-.
>  |   __/  |    Thank you for PostGIS-2.0 Topology !
>  |  / 2.0 |    http://www.pledgebank.com/postgistopology
>  `-o------'
>



More information about the postgis-devel mailing list