[postgis-devel] crash (somehow) resolved (was: different EWKB representations on different machines?)

strk at refractions.net strk at refractions.net
Fri Nov 11 09:51:58 PST 2005


Alex, I've committed a fix for some memory-related bugs.
Would you make some tests with the latest revision
in the pgis_1_0 branch of CVS ?

BTW, the change also involves a speedup in serialization
functions.

--strk;

On Fri, Nov 11, 2005 at 12:03:51PM +0100, strk at refractions.net wrote:
> I think I've found the problem.
> It's in lwpoint.c around line 77:
> 
>         else if (TYPE_NDIMS(point->type) == 2)
>                 getPoint2d_p(point->point, 0, (POINT2D *)loc);
>         else if (TYPE_NDIMS(point->type) == 4)
>                 getPoint4d_p(point->point, 0, (POINT4D *)loc);
> 
> The POINT4D and POINT2D casts do not take memory alignment into
> account. Checking around I found that this construct is used
> also in line and polygon serializers.
> 
> I'll provide you with a patch for testing, meanwhile it would
> be useful if you provide a set of tests with all geometry types
> and all dimensions with and w/out a bounding box. (well, should
> add this to the regress test actually).
> 
> --strk;
> 
> On Fri, Nov 11, 2005 at 12:40:57AM +0100, Alex Mayrhofer wrote:
> > strk at refractions.net wrote:
> > >Yes, printf debugging is the way to go.
> > >It's lwnotice() in this case, same signature as printf().
> > 
> > Ok, i've tracked it down to:
> > 
> > Program received signal SIGBUS, Bus error.
> > getPoint4d_p (pa=0x3af658, n=0, point=0x3af515) at lwgeom_api.c:445
> > 445             memset(point, 0, sizeof(POINT3DZ));
> > (gdb) bt
> > #0  getPoint4d_p (pa=0x3af658, n=0, point=0x3af515) at lwgeom_api.c:445
> > #1  0x7107db94 in lwpoint_serialize_buf (point=0x3af678, buf=0x3af510 "q",
> >     retsize=0xefffe7f4) at lwpoint.c:85
> > #2  0x7107da08 in lwpoint_serialize (point=0x3af678) at lwpoint.c:21
> > #3  0x7108e75c in LWGEOM_pointn_linestring (fcinfo=0xefffe8e8)
> >     at lwgeom_ogc.c:546
> > 
> > [...]
> > 
> > i've tried to figure out what goes wrong in the memset() call - i didn't 
> > find an abvious problem (besides that the 4D code uses "sizeof(POINT3DM)", 
> > which is probably 8 bytes too few).
> > 
> > However, when i desperately tried to _remove_ the memset line from the code 
> > (and the similar line around lwgeom_api.c:496) my query suddenly works (i 
> > was inspired to do that because the 2D code around lwgeom_api.c:557 does 
> > _not_ initialize the point before copying it...)
> > 
> > So, the problem is solved for me - anybody sparc-savvy here who could 
> > enlighten me?
> > 
> > cheers
> > 
> > alex
> > _______________________________________________
> > postgis-devel mailing list
> > postgis-devel at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-devel
> 
> -- 
> 
>  /"\    ASCII Ribbon Campaign
>  \ /    Respect for open standards
>   X     No HTML/RTF in email
>  / \    No M$ Word docs in email
> 
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel

-- 

 /"\    ASCII Ribbon Campaign
 \ /    Respect for open standards
  X     No HTML/RTF in email
 / \    No M$ Word docs in email




More information about the postgis-devel mailing list