[postgis-users] Postgis on Solaris - gdb details
strk at refractions.net
strk at refractions.net
Thu Feb 10 09:54:43 PST 2005
On Thu, Feb 10, 2005 at 09:49:08AM -0800, Ionut Iordache wrote:
> Awesome! I updated cvs and not it works... Thanks a lot !!
> What was the problem?
Memory alignment constraints, it seems.
For an insight see:
http://postgis.refractions.net/pipermail/postgis-devel/2004-March/000171.html
Now we should check for everything else to work as
the just-committed patch was pretty wide ;)
Markus, can you reproduce the profilings ?
I'm afraid we lost some speed on this issue..
--strk;
>
> Cheers,
> Ionut
>
>
> Thursday, February 10, 2005, 9:39:48 AM, you wrote:
>
> srn> I just sent you an email, this one is just to tell you that
> srn> the changes reported in my previous mail will take some time
> srn> before going in the snapshot published on the website.
> srn> If you have a cvs client they are available now.
>
> srn> --strk;
>
> srn> On Thu, Feb 10, 2005 at 09:33:10AM -0800, Ionut Iordache wrote:
> >> Hello strk,
> >>
> >> Thanks for the quick response! See bellow...
> >>
> >> Thursday, February 10, 2005, 1:28:03 AM, you wrote:
> >>
> >> srn> On Wed, Feb 09, 2005 at 07:07:53PM -0800, Ionut Iordache wrote:
> >> >> Hello,
> >> >>
> >> >> I found a more specific reason why my installation crashes:
> >> >>
> >> >> Following is an excerpt from running gdb against the backend and
> >> >> breaking at a point close to where it crashes after executing " select
> >> >> X(geom) from gtest;":
> >> >>
> >> >>
> >> ----------------------------------------------------------------------
> >> >> Breakpoint 2, LWGEOM_x_point (fcinfo=0xffbed600) at lwgeom_ogc.c:528
> >> >> 528 if ( point == NULL ) PG_RETURN_NULL();
> >> >> (gdb) print point
> >> >> $1 = (LWPOINT *) 0x37f188
> >> >> (gdb) print point->point
> >> >> $2 = (POINTARRAY *) 0x37f248
> >> >> (gdb) print point->point->dims
> >> >> $3 = 0 '\0'
> >> >> (gdb) print point->point->npoints
> >> >> $4 = 1
> >> >> (gdb) n
> >> >> 531 p = (POINT2D *)getPoint(point->point, 0);
> >> >> (gdb) print p
> >> >> Cannot access memory at address 0xfffffff0
> >> >> (gdb) n
> >> >> 533 PG_RETURN_FLOAT8(p->x);
> >> >> (gdb) n
> >> >>
> >> >> Program received signal SIGSEGV, Segmentation fault.
> >> >> LWGEOM_x_point (fcinfo=0xffbed600) at lwgeom_ogc.c:533
> >> >> 533 PG_RETURN_FLOAT8(p->x);
> >> >> (gdb)
> >> >>
> >> ------------------------------------------------------------------
> >> >>
> >> >> My understanding is that the POINTARRAY structure passed to the "getPoint"
> >> >> function is somehow invalid... One obvious thing that I noticed (and I
> >> >> might be way off track here, it's my first time reading through this
> >> >> code...) is that the dimension is always 0, where this is noted in
> >> >> the source files:
> >> >>
> >> >> /size of point represeneted in the POINTARRAY
> >> >> // 16 for 2d, 24 for 3d, 32 for 4d
> >> >> int
> >> >> pointArray_ptsize(const POINTARRAY *pa)
> >> >> {
> >> >> return sizeof(double)*TYPE_NDIMS(pa->dims);
> >> >> }
> >> >>
> >> >> I also tested with LINESTRING and pointArray_ptsize will always return
> >> >> 0 here...
> >> >>
> >>
> >> srn> POINTARRAY.dims is used as a bitfield for hasZ and hasM flags. 0==2d.
> >> srn> Can you print value of pa->serialized_pointlist ?
> >> srn> Return from getPoint should be an offset from there
> >> srn> (+16*pointN for a 2d ptarray, same address X)
> >> srn> --strk;
> >>
> >> Hmm.. how about the value pointArray_ptsize(pa) is supposed to return?
> >> That's always 0 in my case... Then, char* getPoint(const
> >> POINTARRAY*,int), does this:
> >> // this does x,y
> >> return &(pa->serialized_pointlist[size*n]);
> >> , where the function is supposed to get the nth point of a POINTARRAY,
> >> but it doesn't get the chance to move beyond index 0, because of
> >> 'size'...
> >>
> >> To prove this, look at the following output:
> >>
> >>
> >> -------------------------------------------------------------------
> >> Breakpoint 2 at 0xfeee449c: file lwgeom_api.c, line 610.
> >> (gdb) cont
> >> Continuing.
> >>
> >> Breakpoint 2, getPoint (pa=0x37f248, n=0) at lwgeom_api.c:610
> >> 610 size = pointArray_ptsize(pa);
> >> (gdb) print size
> >> $1 = 0
> >> (gdb) n
> >> 612 return &(pa->serialized_pointlist[size*n]);
> >> (gdb) print pa
> >> $2 = (const POINTARRAY *) 0x37f248
> >> (gdb) print pa->serialized_pointlist
> >> $3 = (uchar *) 0xfdcc5e19 "@"
> >> (gdb) n
> >> 0xfeee44d4 602 return NULL;
> >> (gdb) n
> >> lwgeom_pointarray_length2d (pts=0x37f248) at measures.c:485
> >> 485 POINT2D *to = (POINT2D *)getPoint(pts, i+1);
> >> (gdb) print to->x
> >> $4 = 2
> >> (gdb) print to->y
> >> $5 = 3
> >> (gdb) cont
> >> Continuing.
> >>
> >> Breakpoint 2, getPoint (pa=0x37f248, n=1) at lwgeom_api.c:610
> >> 610 size = pointArray_ptsize(pa);
> >> (gdb) print size
> >> $6 = 0
> >> (gdb) n
> >> 612 return &(pa->serialized_pointlist[size*n]);
> >> (gdb) print pa
> >> $7 = (const POINTARRAY *) 0x37f248
> >> (gdb) print pa->serialized_pointlist
> >> $8 = (uchar *) 0xfdcc5e19 "@"
> >> (gdb) n
> >> 0xfeee44d4 602 return NULL;
> >> (gdb) n
> >> lwgeom_pointarray_length2d (pts=0x37f248) at measures.c:486
> >> 486 dist += sqrt( ( (frm->x - to->x)*(frm->x - to->x) ) +
> >> (gdb) print frm->x
> >> $9 = 2
> >> (gdb) print frm->y
> >> $10 = 3
> >> ----------------------------------------------------------------------------
> >>
> >> I captured that after I run:
> >> select length2D(geom) from gtest;
> >> on this table:
> >> test=# select astext(geom) from gtest ;
> >> astext
> >> -----------------------------
> >> LINESTRING(2 3,4 5,6 5,7 8)
> >> (1 row)
> >>
> >> In the case above, it crashes because "to" and "frm" point to the
> >> exact same address...
> >>
> >> Any ideas ??
> >>
> >> Thanks!
> >>
> >> PS: I did tried with the latest CVS version, actually, the output
> >> above is generated with the cvs version.
> >>
> >> >>
> >> >> Any help is greatly appreciated!
> >> >>
> >> >>
> >> >> Tuesday, February 8, 2005, 2:40:23 PM, you wrote:
> >> >>
> >> >> II> Hello,
> >> >>
> >> >> II> I've been having problems for a while with Postgis on Solaris 8
> >> >> II> (sparc). I have tried various combinations of Postgresql 8.0.1, 7.4.6
> >> >> II> with Postgis versions 0.9.1 and up.
> >> >> II> The problem is that after the packages compile relatively without
> >> >> II> hassle, I can't use any postgis spatial function without crashing the
> >> >> II> database.
> >> >> II> For example, I create an empty database, add the lwpostgis.sql
> >> >> II> extension, create a spatial table with point geometry, insert one row
> >> >> II> into the table... up to this point everything is fine... when I run
> >> >> II> "select astext(geom) ..." the point shows up correctly, but when I
> >> >> II> execute "select X(geom) ..." the backend crashes:
> >> >>
> >> >>
> >> >> II> server closed the connection unexpectedly
> >> >> II> This probably means the server terminated abnormally
> >> >> II> before or while processing the request.
> >> >> II> The connection to the server was lost. Attempting reset: Failed
> >> >>
> >> >>
> >> >> II> I compiled with LDFLAGS="-lstdc++ -lgcc" and gcc 3.4.1.
> >> >> II> My gcc installation is configured as follows:
> >> >> II> Reading specs from
> >> >> II>
> >> >>
> >> /a/perry/data/pkgs3/local/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.1/specs
> >> >> II> Configured with: ../configure --with-as=/usr/ccs/bin/as
> >> >> II> --with-ld=/usr/ccs/bin/ld --disable-nls
> >> >> II> Thread model: posix
> >> >> II> gcc version 3.4.1
> >> >>
> >> >> II> The compiler uses Sun's linker and I was wondering if this is part of
> >> >> II> the problem... When I try to compile with GNU's ld, I get a
> >> >> II> "option -dn and -P are incompatible" linker error.
> >> >>
> >> >> II> The logs are not showing anything interesting, even with the highest
> >> >> II> debug option set...
> >> >> II> I also tried to debug the backend, but I get this error in gdb:
> >> >> II> Reading symbols from /usr/local/lib/libstdc++.so.6...Error
> >> >> II> while reading shared library symbols:
> >> >> II> Dwarf Error: Cannot handle DW_FORM_strp in DWARF reader.
> >> >>
> >> >>
> >> >>
> >> >> II> So, is anyone else using lwgeom Postgis on Solaris 8? Did you compile
> >> >> II> gcc from scratch, or used the binaries from sunfreeware.com ?
> >> >> II> Any ideas of what might go wrong with my installation?
> >> >>
> >> >>
> >> >> II> Many thanks,
> >> >> II> -----------------------------------------------
> >> >> II> Dorel Ionut Iordache - <ionut at eps.berkeley.edu>
> >> >> II> UC Berkeley - Earth & Planetary Science Dept.
> >> >>
> >> >> II> _______________________________________________
> >> >> II> postgis-users mailing list
> >> >> II> postgis-users at postgis.refractions.net
> >> >> II>
> >> http://postgis.refractions.net/mailman/listinfo/postgis-users
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Best regards,
> >> >> -----------------------------------------------
> >> >> Dorel Ionut Iordache - <ionut at eps.berkeley.edu>
> >> >> UC Berkeley - Earth & Planetary Science Dept.
> >> >>
> >> >> _______________________________________________
> >> >> postgis-users mailing list
> >> >> postgis-users at postgis.refractions.net
> >> >> http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>
> >>
> >>
> >> --
> >> Best regards,
> >> -----------------------------------------------
> >> Dorel Ionut Iordache - <ionut at eps.berkeley.edu>
> >> UC Berkeley - Earth & Planetary Science Dept.
>
>
>
> --
> Best regards,
> -----------------------------------------------
> Dorel Ionut Iordache - <ionut at eps.berkeley.edu>
> UC Berkeley - Earth & Planetary Science Dept.
More information about the postgis-users
mailing list