mapserv segfaults trying to get thequery results of a native oracle spati
Fernando Simon
fsimon at UNIVALI.BR
Mon May 2 05:59:09 PDT 2005
Hi Nicol and Bart,
It's a strange problem for Linux box, what GCC are you using, 4.0?
I will check this problem, I saw a problem here with query's when I
defined a filter parameter for my layer. But it isn't the problem in
your case, or did you denine any filter for the layer in your mapscript?.
Here I used in a project this code to retrieve the data from Oracle
layer:
$camada->open();
for($i = 0; $i < $total_results; $i++)
{
$sindex = $camada->getResult($i);
$result = $camada->getShape(-1,$sindex->shapeindex);
if ($result->type == 0)
{
$x = $result->bounds->minx;
$y = $result->bounds->miny;
$ponto_temp = ms_newpointObj();
$ponto_temp->setXY($x, $y);
if ($rectangle->contains($ponto_temp))
{
$arraytmp =
array($result->values[$nm_campo_sel],$result->values[$desc]);
array_push($resultado_selecao[$nm_campo_array],
$arraytmp);
}
$ponto_temp->free();
}
else
{
if(($rectangle->intersects($result) == MS_TRUE))
{
$arraytmp =
array($result->values[$nm_campo_sel],$result->values[$desc]);
array_push($resultado_selecao[$nm_campo_array],
$arraytmp);
}
}
$result->free();
}
$camada->close();
In this code I executed a "open" before retrieve the shapes ($camada
is a layerobj). Did you execute this function before the getshape? (I
used "-1" for tile index too).
The problem with Oracle Spatial and "--enable-point-z" flag was
solved, you can see this in #1244 Mapserver bugzilla.
Thanks.
------------------------------------------------------------------------
Fernando Simon
Mapserver and Oracle Spatial developer
G10 - Laboratorio de Computacao Aplicada - Brazil
http://g10.cttmar.univali.br - UNIVALI/CTTMAR
------------------------------------------------------------------------
Nicol Hermann wrote:
>Hi Bart,
>
>thanks again for your mail.
>I changed the data statement one more time but unfortunately without
>luck.
>
><short gdb output>
>
>Program received signal SIGSEGV, Segmentation fault.
>[Switching to Thread 16384 (LWP 8480)]
>msOracleSpatialLayerGetShape (layer=0x8285d60, shape=0x82ff510,
>record=0) at maporaclespatial.c:2003
>2003 msOracleSpatialDataHandler *dthand =
>(msOracleSpatialDataHandler *)layerinfo->oradatahandlers;
>
></short gdb output>
>
>Yes i think Fernando needs to step in.
>
>Thanks again for your help
>Nicol
>
>
>Am Montag, den 02.05.2005, 11:23 +0200 schrieb Bart van den Eijnden:
>
>
>>Hi Nicol,
>>
>>I have had similar crashes on Windows which were solved magically by compiling with Visual Studio 7 instead of 6. But for Fernando a similar situation on Linux worked fine.
>>
>>Can you try the following data statement as a last resort:
>>
>>DATA "GEOMETRIE from (SELECT ID, GEOMETRIE FROM FLURST) USING UNIQUE ID SRID 82027"
>>
>>That used to work for me on Windows even with Visual Studio 6, but then you miss a lot of attribute info ofcourse.
>>
>>Probably Fernando needs to step in and help, but in Brazil it is still quite early I guess :-)
>>
>>Best regards,
>>Bart
>>
>>Bart van den Eijnden
>>Syncera-ITSolutions
>>Postbus 270
>>2600 AG DELFT
>>
>>tel.nr.: 015-7512436
>>email: BEN at Syncera-ITSolutions.nl
>>
>>
>>
>>>>>Nicol Hermann <mapserver at geoworld.de> 05/02/05 11:17am >>>
>>>>>
>>>>>
>>Hi Bart, Fernando, List
>>
>>thank you for your mail.
>>I changed the DATA statement according to your advice.
>>The statement is:
>>DATA "GEOMETRIE from (SELECT * FROM FLURST) USING UNIQUE ID SRID 82027"
>>
>>Sadly this changes nothing. I further get a segfault.
>>Attached the new 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 8349)]
>>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 11:07:01 2005].683777 msOracleSpatialLayerOpen called with:
>>GEOMETRIE from (SELECT * FROM FLURST) USING UNIQUE ID SRID 82027
>>[Mon May 2 11:07:01 2005].846399 msOracleSpatialLayerOpen. Shared
>>connection not available. Creating one.
>>[Mon May 2 11:07:01 2005].846593
>>msConnPoolRegister(Oracle,user/passwd at BOX.os,0x82bcd98)
>>[Mon May 2 11:07:01 2005].853183 msOracleSpatialLayerFreeItemInfo was
>>called.
>>[Mon May 2 11:07:01 2005].882663 msOracleSpatialLayerWhichShapes was
>>called.
>>[Mon May 2 11:07:01 2005].888674 msOracleSpatialLayerWhichShapes. Using
>>this Sql to retrieve the data: SELECT ID, GEOMETRIE FROM (SELECT * 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 11:07:23 2005].259709 msOracleSpatialLayerFreeItemInfo was
>>called.
>>[Mon May 2 11:07:23 2005].259903 msOracleSpatialLayerClose was called.
>>Layer connection: user/passwd at BOX.os
>>[Mon May 2 11:07:23 2005].259978 msOracleSpatialLayerClose. Cleaning
>>layerinfo handlers.
>>[Mon May 2 11:07:23 2005].260121 msOracleSpatialLayerClose. Cleaning
>>Oracle handlers.
>>[Mon May 2 11:07:23 2005].260214
>>msConnPoolRelease(Oracle,user/passwd at BOX.os,0x82bcd98)
>>[Mon May 2 11:07:23 2005].260293
>>msConnPoolClose(user/passwd at BOX.os,0x82bcd98)
>><IMG SRC=/~nicol/mapserver/phpmapserver/tmp/111502482183491.gif>
>><p>Anzahl der Layer: 1 - Anzahl der Klassen dieses Layers: [Mon May 2
>>11:07:23 2005].372014 msOracleSpatialLayerOpen called with: GEOMETRIE
>>from (SELECT * FROM FLURST) USING UNIQUE ID SRID 82027
>>[Mon May 2 11:07:23 2005].449381 msOracleSpatialLayerOpen. Shared
>>connection not available. Creating one.
>>[Mon May 2 11:07:23 2005].449542
>>msConnPoolRegister(Oracle,user/passwd at BOX.os,0x82f7f98)
>>[Mon May 2 11:07:23 2005].455171 msOracleSpatialLayerFreeItemInfo was
>>called.
>>[Mon May 2 11:07:23 2005].513718 msOracleSpatialLayerGetItems was
>>called.
>>[Mon May 2 11:07:23 2005].514835 msOracleSpatialLayerInitItemInfo was
>>called.
>>[Mon May 2 11:07:23 2005].527714 msOracleSpatialLayerFreeItemInfo was
>>called.
>>[Mon May 2 11:07:23 2005].527815 msOracleSpatialLayerGetItems was
>>called.
>>[Mon May 2 11:07:23 2005].617739 msOracleSpatialLayerInitItemInfo was
>>called.
>>x: 0 - y: 0 [Mon May 2 11:07:23 2005].618040 msOracleSpatialLayerOpen
>>called with: GEOMETRIE from (SELECT * FROM FLURST) USING UNIQUE ID SRID
>>82027
>>[Mon May 2 11:07:23 2005].618059 msOracleSpatialLayerFreeItemInfo was
>>called.
>>[Mon May 2 11:07:23 2005].618075 msOracleSpatialLayerWhichShapes was
>>called.
>>[Mon May 2 11:07:23 2005].618136 msOracleSpatialLayerWhichShapes. Using
>>this Sql to retrieve the data: SELECT ID, GEOMETRIE FROM (SELECT * 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 11:07:23 2005].731214 msOracleSpatialLayerFreeItemInfo was
>>called.
>>[Mon May 2 11:07:23 2005].731264 msOracleSpatialLayerClose was called.
>>Layer connection: user/passwd at BOX.os
>>[Mon May 2 11:07:23 2005].731276 msOracleSpatialLayerClose. Cleaning
>>layerinfo handlers.
>>[Mon May 2 11:07:23 2005].731309 msOracleSpatialLayerClose. Cleaning
>>Oracle handlers.
>>[Mon May 2 11:07:23 2005].731321
>>msConnPoolRelease(Oracle,user/passwd at BOX.os,0x82f7f98)
>>[Mon May 2 11:07:23 2005].731337
>>msConnPoolClose(user/passwd at BOX.os,0x82f7f98)
>>Anzahl: 1 <br>0. ErgebnisstdClass Object
>>(
>> [shapeindex] => 0
>> [tileindex] => -1
>> [classindex] => 0
>>)
>>
>>Program received signal SIGSEGV, Segmentation fault.
>>[Switching to Thread 16384 (LWP 8349)]
>>msOracleSpatialLayerGetShape (layer=0x8285d60, shape=0x82df3e0,
>>record=0) at maporaclespatial.c:2003
>>2003 msOracleSpatialDataHandler *dthand =
>>(msOracleSpatialDataHandler *)layerinfo->oradatahandlers;
>>
>>
>>Am Montag, den 02.05.2005, 10:57 +0200 schrieb Bart van den Eijnden:
>>
>>
>>>Hi Nicol,
>>>
>>>In order to use query functionality you need to define a different DATA statement, something like:
>>>
>>>DATA "GEOMETRIE from (SELECT * FROM FLURST) USING UNIQUE ID SRID 82027"
>>>
>>>where ID is the name of your unique column (primary key most of the time).
>>>
>>>Best regards,
>>>Bart
>>>
>>>Bart van den Eijnden
>>>Syncera-ITSolutions
>>>Postbus 270
>>>2600 AG DELFT
>>>
>>>tel.nr.: 015-7512436
>>>email: BEN at Syncera-ITSolutions.nl
>>>
>>>
>>>
>>>>>>Nicol Hermann <mapserver at GEOWORLD.DE> 05/02/05 10:50am >>>
>>>>>>
>>>>>>
>>>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:
>>>
>>>
>>>
>><cut old gdb output>
>>
>>
>>
>>>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