mapserv segfaults trying to get the query results of a native oracle spatial data source

Nicol Hermann mapserver at GEOWORLD.DE
Mon May 2 04:50:52 EDT 2005


Hi Fernando,

thank you very much for your e-mail.
I tried the latest CVS version ($Id: maporaclespatial.c,v 1.26
2005/04/28 22:19:41 rodrigo Exp $) with the '--enable-point-z-m'
compiling flag but it did not change the situation.
Mapserver crashes when it try to access the search results with:

$shpobj = $Layer->getShape($oRes->tileindex,$oRes->shapeindex);

I also found, that nearly the hole map-object is empty when i add the
'--enable-point-z-m' compiling flag (see attached gdb output) and try to
access it with PHP Mapscript.

$map = ms_newMapObj('oracle_test_gk3.map') or die('Error.');
var_dump($map);

Removing this flag gives me the normal look.

Here is my oracle layer definition.
Yes i define a template, and no i did not define any filter parameter:

LAYER
     NAME Oracle
     STATUS DEFAULT
     TYPE POLYGON
     DEBUG ON
     CONNECTIONTYPE oraclespatial
     CONNECTION "user/passwd at BOX.os"
     DATA "GEOMETRIE from FLURST USING SRID 82027"
     PROJECTION
       "init=epsg:31467"
     END
     CLASS
        NAME gw
        TEMPLATE "dummy.html"
        STYLE
           COLOR 192 192 192
           OUTLINECOLOR 0 0 0
        END
     END
  END


Should i open a bug on this?
Many thanks
Nicol


gdb-Output:

nicol at emil:~/public_html/mapserver/dev$ gdb php
GNU gdb 6.3-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i386-linux"...Using host libthread_db
library "/lib/libthread_db.so.1".

(gdb) run nativ_oraclequelle_query.php
Starting program: /usr/local/bin/php nativ_oraclequelle_query.php
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 8137)]
Content-type: text/html
X-Powered-By: PHP/4.3.8

ms_map_obj Object
(
    [_handle_] => Resource id #1
    [numlayers] => 1
    [name] => Karte
    [status] => 1
    [debug] => 0
    [width] => 300
    [height] => 300
    [maxsize] => 2048
    [transparent] => 0
    [interlace] => 0
    [imagetype] =>
    [imagequality] => 0
    [extent] => ms_rect_obj Object
        (
            [_handle_] => Resource id #2
            [minx] => 0
            [miny] => 0
            [maxx] => 0
            [maxy] => 0
        )

    [cellsize] => 0
    [units] => 0
    [scale] => 0
    [resolution] => 0
    [shapepath] =>
    [keysizex] => 0
    [keysizey] => 0
    [keyspacingx] => 0
    [keyspacingy] => 0
    [symbolsetfilename] =>
    [fontsetfilename] =>
    [mappath] =>
    [imagecolor] => ms_color_obj Object
        (
            [_handle_] => Resource id #3
            [red] => 0
            [green] => 0
            [blue] => 0
        )

    [web] => ms_web_obj Object
        (
            [_handle_] => Resource id #4
            [log] =>
            [imagepath] =>
            [template] =>
            [imageurl] =>
            [header] =>
            [footer] =>
            [empty] =>
            [error] =>
            [mintemplate] =>
            [maxtemplate] =>
            [minscale] => 0
            [maxscale] => 0
            [queryformat] =>
            [extent] => ms_rect_obj Object
                (
                    [_handle_] => Resource id #5
                    [minx] => 0
                    [miny] => 0
                    [maxx] => 0
                    [maxy] => 0
                )

        )

    [reference] => ms_reference_obj Object
        (
            [_handle_] => Resource id #6
            [image] =>
            [width] => 0
            [height] => 0
            [status] => 0
            [extent] => ms_rect_obj Object
                (
                    [_handle_] => Resource id #7
                    [minx] => 0
                    [miny] => 0
                    [maxx] => 0
                    [maxy] => 0
                )

            [color] => ms_color_obj Object
                (
                    [_handle_] => Resource id #8
                    [red] => 0
                    [green] => 0
                    [blue] => 0
                )

            [outlinecolor] => ms_color_obj Object
                (
                    [_handle_] => Resource id #9
                    [red] => 0
                    [green] => 0
                    [blue] => 0
                )

        )

    [scalebar] => ms_scalebar_obj Object
        (
            [_handle_] => Resource id #10
            [height] => 0
            [width] => 0
            [style] => 0
            [intervals] => 0
            [units] => 0
            [status] => 0
            [position] => 0
            [transparent] => 0
            [interlace] => 0
            [postlabelcache] => 0
            [label] => ms_label_obj Object
                (
                    [_handle_] => Resource id #11
                    [font] =>
                    [encoding] =>
                    [type] => 0
                    [shadowsizex] => 0
                    [shadowsizey] => 0
                    [backgroundshadowsizex] => 0
                    [backgroundshadowsizey] => 0
                    [size] => 0
                    [minsize] => 0
                    [maxsize] => 0
                    [position] => 0
                    [offsetx] => 0
                    [offsety] => 0
                    [angle] => 0
                    [autoangle] => 0
                    [buffer] => 0
                    [antialias] => 0
                    [wrap] => 0
                    [minfeaturesize] => 0
                    [autominfeaturesize] => 0
                    [mindistance] => 0
                    [partials] => 0
                    [force] => 0
                    [color] => ms_color_obj Object
                        (
                            [_handle_] => Resource id #12
                            [red] => 0
                            [green] => 0
                            [blue] => 0
                        )

                    [outlinecolor] => ms_color_obj Object
                        (
                            [_handle_] => Resource id #13
                            [red] => 0
                            [green] => 0
                            [blue] => 0
                        )

                    [shadowcolor] => ms_color_obj Object
                        (
                            [_handle_] => Resource id #14
                            [red] => 0
                            [green] => 0
                            [blue] => 0
                        )

                    [backgroundcolor] => ms_color_obj Object
                        (
                            [_handle_] => Resource id #15
                            [red] => 0
                            [green] => 0
                            [blue] => 0
                        )

                    [backgroundshadowcolor] => ms_color_obj Object
                        (
                            [_handle_] => Resource id #16
                            [red] => 0
                            [green] => 0
                            [blue] => 0
                        )

                )

            [imagecolor] => ms_color_obj Object
                (
                    [_handle_] => Resource id #17
                    [red] => 0
                    [green] => 0
                    [blue] => 0
                )

            [color] => ms_color_obj Object
                (
                    [_handle_] => Resource id #18
                    [red] => 0
                    [green] => 0
                    [blue] => 0
                )

            [backgroundcolor] => ms_color_obj Object
                (
                    [_handle_] => Resource id #19
                    [red] => 0
                    [green] => 0
                    [blue] => 0
                )

            [outlinecolor] => ms_color_obj Object
                (
                    [_handle_] => Resource id #20
                    [red] => 0
                    [green] => 0
                    [blue] => 0
                )

        )

    [legend] => ms_legend_obj Object
        (
            [_handle_] => Resource id #21
            [height] => 0
            [width] => 0
            [keysizex] => 0
            [keysizey] => 0
            [keyspacingx] => 0
            [keyspacingy] => 0
            [status] => 0
            [position] => 0
            [transparent] => 0
            [interlace] => 0
            [postlabelcache] => 0
            [template] =>
            [label] => ms_label_obj Object
                (
                    [_handle_] => Resource id #22
                    [font] =>
                    [encoding] =>
                    [type] => 0
                    [shadowsizex] => 0
                    [shadowsizey] => 0
                    [backgroundshadowsizex] => 0
                    [backgroundshadowsizey] => 0
                    [size] => 0
                    [minsize] => 0
                    [maxsize] => 0
                    [position] => 0
                    [offsetx] => 0
                    [offsety] => 0
                    [angle] => 0
                    [autoangle] => 0
                    [buffer] => 0
                    [antialias] => 0
                    [wrap] => 0
                    [minfeaturesize] => 0
                    [autominfeaturesize] => 0
                    [mindistance] => 0
                    [partials] => 0
                    [force] => 0
                    [color] => ms_color_obj Object
                        (
                            [_handle_] => Resource id #23
                            [red] => 0
                            [green] => 0
                            [blue] => 0
                        )

                    [outlinecolor] => ms_color_obj Object
                        (
                            [_handle_] => Resource id #24
                            [red] => 0
                            [green] => 0
                            [blue] => 0
                        )

                    [shadowcolor] => ms_color_obj Object
                        (
                            [_handle_] => Resource id #25
                            [red] => 0
                            [green] => 0
                            [blue] => 0
                        )

                    [backgroundcolor] => ms_color_obj Object
                        (
                            [_handle_] => Resource id #26
                            [red] => 0
                            [green] => 0
                            [blue] => 0
                        )

                    [backgroundshadowcolor] => ms_color_obj Object
                        (
                            [_handle_] => Resource id #27
                            [red] => 0
                            [green] => 0
                            [blue] => 0
                        )

                )

            [imagecolor] => ms_color_obj Object
                (
                    [_handle_] => Resource id #28
                    [red] => 0
                    [green] => 0
                    [blue] => 0
                )

            [outlinecolor] => ms_color_obj Object
                (
                    [_handle_] => Resource id #29
                    [red] => 0
                    [green] => 0
                    [blue] => 0
                )

        )

    [latlon] => ms_projection_obj Object
        (
            [_handle_] => Resource id #30
        )

    [outputformat] =>
    [labelcache] => ms_labelcache_obj Object
        (
            [_handle_] => Resource id #31
        )

)
[Mon May  2 10:19:22 2005].888452 msOracleSpatialLayerOpen called with:
GEOMETRIE from FLURST USING SRID 82027
[Mon May  2 10:19:23 2005].93962 msOracleSpatialLayerOpen. Shared
connection not available. Creating one.
[Mon May  2 10:19:23 2005].94024
msConnPoolRegister(Oracle,user/passwd at BOX.os,0x82bcd78)
[Mon May  2 10:19:23 2005].100358 msOracleSpatialLayerFreeItemInfo was
called.
[Mon May  2 10:19:23 2005].101489 msOracleSpatialLayerWhichShapes was
called.
[Mon May  2 10:19:23 2005].101597 msOracleSpatialLayerWhichShapes. Using
this Sql to retrieve the data: SELECT rownum, GEOMETRIE FROM FLURST
WHERE SDO_FILTER( GEOMETRIE, MDSYS.SDO_GEOMETRY(2003, 82027,
NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),MDSYS.SDO_ORDINATE_ARRAY(3384094.22,5499947.53,3427070.22,5542923.53) ),'querytype=window') = 'TRUE'
[Mon May  2 10:19:45 2005].111568 msOracleSpatialLayerFreeItemInfo was
called.
[Mon May  2 10:19:45 2005].111754 msOracleSpatialLayerClose was called.
Layer connection: user/passwd at BOX.os
[Mon May  2 10:19:45 2005].111825 msOracleSpatialLayerClose. Cleaning
layerinfo handlers.
[Mon May  2 10:19:45 2005].111964 msOracleSpatialLayerClose. Cleaning
Oracle handlers.
[Mon May  2 10:19:45 2005].112050
msConnPoolRelease(Oracle,user/passwd at BOX.os,0x82bcd78)
[Mon May  2 10:19:45 2005].112124
msConnPoolClose(user/passwd at BOX.os,0x82bcd78)
<IMG SRC=/~nicol/mapserver/phpmapserver/tmp/111502196281371.gif>
<p>Anzahl der Layer: 1 - Anzahl der Klassen dieses Layers: [Mon May  2
10:19:45 2005].129564 msOracleSpatialLayerOpen called with: GEOMETRIE
from FLURST USING SRID 82027
[Mon May  2 10:19:45 2005].156144 msOracleSpatialLayerOpen. Shared
connection not available. Creating one.
[Mon May  2 10:19:45 2005].156290
msConnPoolRegister(Oracle,user/passwd at BOX.os,0x82f7f78)
[Mon May  2 10:19:45 2005].161787 msOracleSpatialLayerFreeItemInfo was
called.
[Mon May  2 10:19:45 2005].164368 msOracleSpatialLayerGetItems was
called.
[Mon May  2 10:19:45 2005].165424 msOracleSpatialLayerInitItemInfo was
called.
[Mon May  2 10:19:45 2005].166837 msOracleSpatialLayerFreeItemInfo was
called.
[Mon May  2 10:19:45 2005].166931 msOracleSpatialLayerGetItems was
called.
[Mon May  2 10:19:45 2005].167639 msOracleSpatialLayerInitItemInfo was
called.
x: 0 - y: 0 [Mon May  2 10:19:45 2005].169442 msOracleSpatialLayerOpen
called with: GEOMETRIE from FLURST USING SRID 82027
[Mon May  2 10:19:45 2005].169568 msOracleSpatialLayerFreeItemInfo was
called.
[Mon May  2 10:19:45 2005].169647 msOracleSpatialLayerWhichShapes was
called.
[Mon May  2 10:19:45 2005].169776 msOracleSpatialLayerWhichShapes. Using
this Sql to retrieve the data: SELECT rownum, GEOMETRIE FROM FLURST
WHERE SDO_FILTER( GEOMETRIE, MDSYS.SDO_GEOMETRY(2003, 82027,
NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),MDSYS.SDO_ORDINATE_ARRAY(3405582.22,5521435.53,3405582.22,5521435.53) ),'querytype=window') = 'TRUE'
[Mon May  2 10:19:45 2005].181548 msOracleSpatialLayerFreeItemInfo was
called.
[Mon May  2 10:19:45 2005].184400 msOracleSpatialLayerClose was called.
Layer connection: user/passwd at BOX.os
[Mon May  2 10:19:45 2005].184504 msOracleSpatialLayerClose. Cleaning
layerinfo handlers.
[Mon May  2 10:19:45 2005].184597 msOracleSpatialLayerClose. Cleaning
Oracle handlers.
[Mon May  2 10:19:45 2005].184667
msConnPoolRelease(Oracle,user/passwd at BOX.os,0x82f7f78)
[Mon May  2 10:19:45 2005].184741
msConnPoolClose(user/passwd at BOX.os,0x82f7f78)
Anzahl: 1 <br>0. ErgebnisstdClass Object
(
    [shapeindex] => 1
    [tileindex] => -1
    [classindex] => 0
)

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 8137)]
msOracleSpatialLayerGetShape (layer=0x8285d60, shape=0x8306c78,
record=1) at maporaclespatial.c:2003
2003        msOracleSpatialDataHandler *dthand =
(msOracleSpatialDataHandler *)layerinfo->oradatahandlers;



Am Donnerstag, den 28.04.2005, 11:42 -0300 schrieb Fernando Simon:
> Hi Nicol,
>     This problem can be a bug in maporaclespatial.c in 4.4.2 version.
> In this version of Mapserver the maporaclespatial is a 1.16 version,
> a old version (now it is a 1.25). I fixed some problems with OCI
> handlers between 1.6 and 1.25, the last version 1.25 can work
> correctly for you.
>     But, it's a strange problem, how did you define oracle spatial
> layer? Did you define the template for the layer? Did you define any
> filter parameter for the layer?
>     Thanks.
>
> ps: for cvs version specify the --enable-point-z-m flag
>
> ------------------------------------------------------------------------
> Fernando Simon
> Mapserver and Oracle Spatial developer
> G10 - Laboratorio de Computacao Aplicada - Brazil
> http://g10.cttmar.univali.br - UNIVALI/CTTMAR
> ------------------------------------------------------------------------
>
> Citando Nicol Hermann <mapserver at GEOWORLD.DE>:
>
> > Dear list,
> >
> > I want to use the query function of the native Oracle Spatial
> > support
> > (INPUT=ORACLESPATIAL) from mapserver 4.4.2.
> > Displaying the image is no problem but when try to get the query
> > results
> > mapserver crashes with a segmentation fault.
> >
> > Here is what i try to do:
> >
> > for($j = 0;$j < $Layer->getNumResults(); $j++) {
> >   $oRes = $Layer->getResult($j);
> >   $shpobj = $Layer->getShape($oRes->tileindex,$oRes->shapeindex);
> > // <-
> > Line which causes the Segmentation fault
> >   $shpobj->free();
> > }
> >
> > Is this a bug or do i have to change something?
> > My system is:
> > Debian sarge, mapserver 4.4.2 (php Mapscript), oracle 10g
> >
> > Attached you find the output of gdb.


<cut old gdb output>


>
> -------------------------------------------------
>   Univali - Webmail - http://webmail.univali.br
>
>



More information about the mapserver-users mailing list