Opened 19 years ago

Closed 19 years ago

#1424 closed defect (worksforme)

GetFeature request with 2 queries both using a Filter crashes Mapserver

Reported by: bartvde@… Owned by: mapserverbugs
Priority: high Milestone:
Component: WFS Server Version: 4.6
Severity: normal Keywords:
Cc:

Description

The following request worked with Mapserver 4.6 beta1 but crashes Mapserver 4.6
release (internal server error):

<GetFeature maxfeatures="100" service="WFS" version="1.0.0"
xmlns="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.opengis.net/wfs/1.0.0 WFS-basic.xsd">
<Query xmlns=""
typename="bisrapport_vlak"><ogc:Filter><ogc:DWithin><ogc:PropertyName>msGeometry</ogc:PropertyName><gml:Polygon
srsName="EPSG:28992"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>104030.047950,498012.127900
104030.263050,498036.333900 104055.456000,498041.950000
104056.623000,498042.210050 104056.669950,498041.993050
104059.873950,498027.176150 104061.607050,498019.162900
104030.047950,498012.127900
</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon><ogc:Distance
units="m">0.01</ogc:Distance></ogc:DWithin></ogc:Filter></Query>
<Query xmlns=""
typename="bislocatie"><ogc:Filter><ogc:DWithin><ogc:PropertyName>msGeometry</ogc:PropertyName><gml:Polygon
srsName="EPSG:28992"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>104030.047950,498012.127900
104030.263050,498036.333900 104055.456000,498041.950000
104056.623000,498042.210050 104056.669950,498041.993050
104059.873950,498027.176150 104061.607050,498019.162900
104030.047950,498012.127900
</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon><ogc:Distance
units="m">0.01</ogc:Distance></ogc:DWithin></ogc:Filter></Query>
</GetFeature>

Python script to POST:

import httplib, urllib, string, base64, time

# 1) set variable for request to be posted

request="""
<GetFeature maxfeatures="100" service="WFS" version="1.0.0"
xmlns="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.opengis.net/wfs/1.0.0 WFS-basic.xsd">
<Query xmlns=""
typename="bisrapport_vlak"><ogc:Filter><ogc:DWithin><ogc:PropertyName>msGeometry</ogc:PropertyName><gml:Polygon
srsName="EPSG:28992"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>104030.047950,498012.127900
104030.263050,498036.333900 104055.456000,498041.950000
104056.623000,498042.210050 104056.669950,498041.993050
104059.873950,498027.176150 104061.607050,498019.162900
104030.047950,498012.127900
</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon><ogc:Distance
units="m">0.01</ogc:Distance></ogc:DWithin></ogc:Filter></Query>
<Query xmlns=""
typename="bislocatie"><ogc:Filter><ogc:DWithin><ogc:PropertyName>msGeometry</ogc:PropertyName><gml:Polygon
srsName="EPSG:28992"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>104030.047950,498012.127900
104030.263050,498036.333900 104055.456000,498041.950000
104056.623000,498042.210050 104056.669950,498041.993050
104059.873950,498027.176150 104061.607050,498019.162900
104030.047950,498012.127900
</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon><ogc:Distance
units="m">0.01</ogc:Distance></ogc:DWithin></ogc:Filter></Query>
</GetFeature>
"""
# 2) set WFS servername and hostname

# productie
server="/cgi-bin/copy1705/mapserv.exe?map=/ms4w/apps/stragisweb/htdocs/sites/ijmond/map/stragisweb.map&amp;service=WFS&amp;version=1.0.0"
hostname="localhost:8080"


# 3) execute the request

h = httplib.HTTP(hostname)
h.putrequest("POST", server)
h.putheader("Content-type", "text/xml")
h.putheader("Content-length", "%d" % len(request))
h.putheader("Accept", "text/xml")
h.putheader('Host', hostname)
h.endheaders()
h.send(request)
reply, msg, hdrs = h.getreply()

# 4) print the response
print h.getfile().read()

Attachments (1)

geodata.tgz (344.5 KB ) - added by bartvde@… 19 years ago.
Data used.

Download all attachments as: .zip

Change History (6)

comment:1 by bartvde@…, 19 years ago

Necessary excerpts from the MAP file:

MAP

  NAME "StraGISWeb"
  CONFIG PROJ_LIB /ms4w/apps/stragisweb/proj
  STATUS ON
  EXTENT 95000 490000 110000 500000
  SIZE 650 400
  FONTSET "fonts/fonts.list"
  SYMBOLSET "symbols/stragisweb.sym"
  IMAGECOLOR 255 255 255
  SHAPEPATH "../data/"
  TRANSPARENT OFF
  UNITS METERS

  PROJECTION
    "init=epsg:28992"
  END

  OUTPUTFORMAT
    NAME png
    DRIVER "GD/PNG"
    MIMETYPE "image/png"
    IMAGEMODE PC256
    EXTENSION "png"
  END

  WEB
    METADATA
      WMS_TITLE "StraGIS Web WMS"
      WMS_ABSTRACT "WMS StraGISWeb"
      WMS_ACCESSCONSTRAINTS "none"
      WMS_SRS "EPSG:28992"
      WFS_TITLE "StraGIS Web WFS"
      ows_schemas_location "http://schemas.cubewerx.com/schemas/"
      wfs_namespace_prefix "stragisweb"
      wfs_namespace_uri "http://www.syncera.nl/stragisweb"
      wfs_onlineresource
"http://localhost:8080/stragisweb/cgi-bin/mapserv.exe?map=/ms4w/apps/stragisweb/htdocs/sites/ijmond/map/stragisweb.map"
    END

END

LAYER
  NAME "bisrapport_vlak"
  METADATA
    wms_title "BIS rapporten (vlakken)"
    wfs_title "BIS rapporten (vlakken)"
    gml_include_items "all"
    stragisweb_searchfield "Rap_code"
    stragisweb_displayfield "Rap_code"
  END
  STATUS ON
  TYPE POLYGON
  DUMP TRUE
  CONNECTIONTYPE OGR
  CONNECTION "bis/geo/bis_rap.TAB"
  MAXSCALE 6000
  PROJECTION
    "init=epsg:28992"
  END
  TOLERANCE 0
  TOLERANCEUNITS PIXELS
  TRANSPARENCY 60
  LABELITEM "Rap_code"
  FILTERITEM "Rap_code"
  CLASS
    NAME "bisrapport (vlak)"
    MINSCALE 0
    MAXSCALE 2000
    STYLE
      COLOR 102 255 0
      OUTLINECOLOR 102 255 0
    END
    LABEL
      TYPE TRUETYPE
      FONT "Arial"
      SIZE 10
      COLOR 0 0 0
    END
  END
  CLASS
    STYLE
      COLOR 102 255 0
      OUTLINECOLOR 102 255 0
    END
    MINSCALE 2001
    MAXSCALE 6000
  END
  TEMPLATE "blank.html"
END

LAYER
  NAME "bislocatie"
  METADATA
    wms_title "BIS locaties"
    wfs_title "BIS locaties"
    gml_include_items "all"
    stragisweb_searchfield "Loc_code"
    stragisweb_displayfield "Loc_code"
  END
  STATUS ON
  DUMP TRUE
  TYPE POLYGON
  CONNECTIONTYPE OGR
  CONNECTION "bis/geo/bis_loc.TAB"
  MAXSCALE 6000
  PROJECTION
    "init=epsg:28992"
  END
  TOLERANCE 3
  TOLERANCEUNITS PIXELS
  TRANSPARENCY 50
  LABELITEM "Loc_code"
  FILTERITEM "Loc_code"
  CLASS
    NAME "bislocatie"
    STYLE
      COLOR 51 153 0
      OUTLINECOLOR 51 153 0
    END
    MINSCALE 0
    MAXSCALE 2000
    LABEL
      TYPE TRUETYPE
      FONT "Arial"
      SIZE 10
      COLOR 0 0 0
    END
  END
  CLASS
    STYLE
      COLOR 51 153 0
      OUTLINECOLOR 51 153 0
    END
    MINSCALE 2000
    MAXSCALE 6000
  END
  TEMPLATE "blank.html"
END

by bartvde@…, 19 years ago

Attachment: geodata.tgz added

Data used.

comment:2 by bartvde@…, 19 years ago

Cc: assefa@… added
Assefa, did you have time to look at this one already? It can be fixed on our
support contract, but please do let me know before if it will be more than 1 or
2 hours.

comment:3 by assefa, 19 years ago

looking into this ...

comment:4 by assefa, 19 years ago

I have tried the following using the data/map provided and both mapserver cvs 
and mapserver 4.6.0 release:

 get request using 2 typnames and 2 filters : http://127.0.0.1/cgi-
bin/mapserv.exe?
map=d:/msapps/tmp/bug1424/test.map&service=wfs&version=1.0.0&request=GetFeature
&typename=bisrapport_vlak,bislocatie&Filter=
(<ogc:Filter><ogc:DWithin><ogc:PropertyName>msGeometry</ogc:PropertyName><gml:P
olygon 
srsName="EPSG:28992"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1040
30.047950,498012.127900 104030.263050,498036.333900 
104055.456000,498041.950000 104056.623000,498042.210050 
104056.669950,498041.993050 104059.873950,498027.176150 
104061.607050,498019.162900 
104030.047950,498012.127900</gml:coordinates></gml:LinearRing></gml:outerBounda
ryIs></gml:Polygon><ogc:Distance 
units="m">0.01</ogc:Distance></ogc:DWithin></ogc:Filter>)
(<ogc:Filter><ogc:DWithin><ogc:PropertyName>msGeometry</ogc:PropertyName><gml:P
olygon 
srsName="EPSG:28992"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1040
30.047950,498012.127900 104030.263050,498036.333900 
104055.456000,498041.950000 104056.623000,498042.210050 
104056.669950,498041.993050 104059.873950,498027.176150 
104061.607050,498019.162900 
104030.047950,498012.127900</gml:coordinates></gml:LinearRing></gml:outerBounda
ryIs></gml:Polygon><ogc:Distance 
units="m">0.01</ogc:Distance></ogc:DWithin></ogc:Filter>)


 and a post request using php curl :

 dl("php_curl.dll");

$url = "http://127.0.0.1/cgi-bin/mapserv.exe?
map=d:/msapps/tmp/bug1424/test.map";
$host = "localhost";

$request = '<GetFeature maxfeatures="100" service="WFS" version="1.0.0" 
xmlns="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" 
xmlns:ogc="http://www.opengis.net/ogc" 
xmlns:xlink="http://www.w3.org/1999/xlink" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://schemas.opengis.net/wfs/1.0.0 WFS-basic.xsd"> 
<Query xmlns="" 
typename="bisrapport_vlak"><ogc:Filter><ogc:DWithin><ogc:PropertyName>msGeometr
y</ogc:PropertyName><gml:Polygon 
srsName="EPSG:28992"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1040
30.047950,498012.127900 104030.263050,498036.333900 
104055.456000,498041.950000 104056.623000,498042.210050 
104056.669950,498041.993050 104059.873950,498027.176150 
104061.607050,498019.162900 
104030.047950,498012.127900</gml:coordinates></gml:LinearRing></gml:outerBounda
ryIs></gml:Polygon><ogc:Distance 
units="m">0.01</ogc:Distance></ogc:DWithin></ogc:Filter></Query><Query 
xmlns="" 
typename="bislocatie"><ogc:Filter><ogc:DWithin><ogc:PropertyName>msGeometry</og
c:PropertyName><gml:Polygon 
srsName="EPSG:28992"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1040
30.047950,498012.127900 104030.263050,498036.333900 
104055.456000,498041.950000 104056.623000,498042.210050 
104056.669950,498041.993050 104059.873950,498027.176150 
104061.607050,498019.162900 
104030.047950,498012.127900</gml:coordinates></gml:LinearRing></gml:outerBounda
ryIs></gml:Polygon><ogc:Distance 
units="m">0.01</ogc:Distance></ogc:DWithin></ogc:Filter></Query></GetFeature>';


$header[] = "Host: $host";
$header[] = "MIME-Version: 1.0";
$header[] = "Content-type: multipart/mixed; boundary=----doc";
$header[] = "Accept: text/xml";
$header[] = "Content-length: ".strlen($request);
$header[] = "Cache-Control: no-cache";
$header[] = "Connection: close \r\n";
$header[] = $request;
     
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 4);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

$data = curl_exec($ch);        
if (curl_errno($ch)) 
{
  print curl_error($ch);
} else 
{
  curl_close($ch);
  echo $data;
}


In both cases I can't reproduce the crash and I get a valid return which is 
something like :

<?xml version='1.0' encoding="ISO-8859-1" ?>
<wfs:FeatureCollection
   xmlns:stragisweb="http://www.syncera.nl/stragisweb"
   xmlns:wfs="http://www.opengis.net/wfs"
   xmlns:gml="http://www.opengis.net/gml"
   xmlns:ogc="http://www.opengis.net/ogc"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.opengis.net/wfs 
http://schemas.cubewerx.com/schemas//wfs/1.0.0/WFS-basic.xsd 
                       http://www.syncera.nl/stragisweb 
http://localhost:8080/stragisweb/cgi-bin/mapserv.exe?
map=/ms4w/apps/stragisweb/htdocs/sites/ijmond/map/stragisweb.map&amp;SERVICE=WF
S&amp;VERSION=1.0.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=bisrapport_vla
k,bislocatie&amp;OUTPUTFORMAT=XMLSCHEMA">
      <gml:boundedBy>
      	<gml:Box srsName="EPSG:28992">
      		<gml:coordinates>103752.446000,497980.614000 
104133.426000,498160.249500</gml:coordinates>
      	</gml:Box>
      </gml:boundedBy>
    <gml:featureMember>
      <stragisweb:bisrapport_vlak>
        <gml:boundedBy>
        	<gml:Box srsName="EPSG:28992">
        		<gml:coordinates>104035.942500,498008.096500 
104062.895500,498055.753000</gml:coordinates>
        	</gml:Box>
        </gml:boundedBy>
        <stragisweb:msGeometry>
        <gml:Polygon srsName="EPSG:28992">
          <gml:outerBoundaryIs>
            <gml:LinearRing>
              <gml:coordinates>104035.942500,498052.237000 
104045.708000,498008.096500 104062.895500,498012.198500 
104053.130000,498055.753000 104035.942500,498052.237000 </gml:coordinates>
            </gml:LinearRing>
          </gml:outerBoundaryIs>
        </gml:Polygon>
        </stragisweb:msGeometry>
        <stragisweb:Rap_code>AA045301551</stragisweb:Rap_code>
        <stragisweb:Xcoord>   104049.419000000</stragisweb:Xcoord>
        <stragisweb:Ycoord>   498031.925121976</stragisweb:Ycoord>
        <stragisweb:Kwaliteit></stragisweb:Kwaliteit>
      </stragisweb:bisrapport_vlak>
    </gml:featureMember>
    <gml:featureMember>
      <stragisweb:bislocatie>
        <gml:boundedBy>
        	<gml:Box srsName="EPSG:28992">
        		<gml:coordinates>103752.446000,497980.614000 
104133.426000,498160.249500</gml:coordinates>
        	</gml:Box>
        </gml:boundedBy>
        <stragisweb:msGeometry>
        <gml:MultiPolygon srsName="EPSG:28992">
        <gml:polygonMember>
          <gml:Polygon>
            <gml:outerBoundaryIs>
              <gml:LinearRing>
                <gml:coordinates>104027.825500,497994.997000 
104026.217500,498067.766000 103819.984000,498069.195000 
103778.577000,498078.047000 103821.701000,498160.249500 
103825.428000,498160.239000 104116.142500,498157.317000 
104115.259000,498074.576500 104133.426000,497993.027500 
104027.825500,497994.997000 </gml:coordinates>
              </gml:LinearRing>
            </gml:outerBoundaryIs>
          </gml:Polygon>
        </gml:polygonMember>
        <gml:polygonMember>
          <gml:Polygon>
            <gml:outerBoundaryIs>
              <gml:LinearRing>
                <gml:coordinates>103759.048500,497981.223000 
103752.446000,498016.585000 103769.454500,498060.194000 
103825.775000,498059.615000 103825.722500,497980.614000 
103759.048500,497981.223000 </gml:coordinates>
              </gml:LinearRing>
            </gml:outerBoundaryIs>
          </gml:Polygon>
        </gml:polygonMember>
        </gml:MultiPolygon>
        </stragisweb:msGeometry>
        <stragisweb:Loc_code>AA045303444</stragisweb:Loc_code>
        <stragisweb:Xcoord>103956</stragisweb:Xcoord>
        <stragisweb:Ycoord>498077</stragisweb:Ycoord>
      </stragisweb:bislocatie>
    </gml:featureMember>
</wfs:FeatureCollection>
 

 Do you see any thing wrong in my tests ? Not sure where to go from here.

comment:5 by bartvde@…, 19 years ago

Resolution: worksforme
Status: newclosed
Assefa, I just rechecked all this. Using mapserver 4.6.0 Windows binary
(14-06-2005) I do still get a crash. But using CVS version (4.7) everything goes
well.

When you tested with 4.6, did you test with the current 4.6 branch in CVS, or
with the actual 4.6.0 release binary?

Apparently this has already been fixed in the meantime ....
For a while I was thinking I must be getting crazy since all the testcases I
provide work for you :-) but I could reproduce with the 4.6.0 Windows release
binary.

Thanks. I'll close this bug.
Note: See TracTickets for help on using tickets.