tinyows icon indicating copy to clipboard operation
tinyows copied to clipboard

TinyOWS crash on post requests

Open aperi2007 opened this issue 12 years ago • 12 comments

Hi,

Try-ing this GET request:

http://web.regione.toscana.it/wfsvector/com.rt.wfs.RTmap/wfs?service=WFS&version=1.1.0&request=GetFeature&typename=catasto:rt_cat.idcatbdfog.rt.bb&maxFeatures=10&Filter=<Filter xmlns:wfs="http://www.opengis.net/wfs"><PropertyIsEqualTo><PropertyName>comune</PropertyName><Literal>FIRENZE</Literal></PropertyIsEqualTo></Filter>

I have a good response .

Instead if I send the same request using a POST method Tiny will crash silently:

This is the post request I try

[Tue Dec 11 10:09:30 2012] [EVENT] == Filling Storage == [Tue Dec 11 10:09:30 2012] [QUERY] <?xml version="1.0" encoding="UTF-8"?> <wfs:GetFeature handle="GeoTools 2.7.4 WFS DataStore" outputFormat="text/xml; subtype=gml/3.1.1" resultType="results" service="WFS" version="1.1.0" xmlns="http://www.opengis.net/ogc" maxFeatures="10" xmlns:gml="http://www.opengis.net/gml" xmlns:ambiti_amministrativi="http://www.regione.toscana.it/" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ows="http://www.opengis.net/ows" xmlns:wfs="http://www.opengis.net/wfs"> <wfs:Query srsName="urn:ogc:def:crs:EPSG::25832" typeName="ambiti_amministrativi:idprovince"> <Filter> <PropertyIsEqualTo matchCase="true"> <PropertyName>nome</PropertyName> <Literal>FIRENZE</Literal> </PropertyIsEqualTo> </Filter> </wfs:Query> </wfs:GetFeature> The log of tiny say nothing else.

Instead from the Tomcat Log I see this error:

INFO: cgi-tinyows: runCGI (stderr):wfs: src/struct/buffer.c:290: buffer_cmp: Assertion `buf' failed.

aperi2007 avatar Dec 11 '12 09:12 aperi2007

Andrea,

I'm not able to reproduce this error. Which TinyOWS version do you use ?

Is it 1.1.0 or trunk ?

ocourtin avatar Dec 12 '12 16:12 ocourtin

I'm using tinyows trunk version on a RedHat Enterprise 6 - 64bit.

aperi2007 avatar Dec 12 '12 17:12 aperi2007

Humm quite strange, could you load tinyows_demo and provide a sample using world or france layer ?

On my own i've used this one for instance:

<?xml version="1.0"?>
<wfs:GetFeature xmlns="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" 
     xmlns:tows="http://www.tinyows.org/" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ows="http://www.opengis.net/ows" xmlns:wfs="http://www.opengis.net/wfs" outputFormat="text/xml; subtype=gml/3.1.1" resultType="results" service="WFS" version="1.1.0" maxFeatures="10">
  <wfs:Query srsName="urn:ogc:def:crs:EPSG::25832" typeName="tows:france">
    <Filter>
      <PropertyIsEqualTo matchCase="true">
        <PropertyName>nom_dept</PropertyName>
        <Literal>PARIS</Literal>
      </PropertyIsEqualTo>
    </Filter>
  </wfs:Query>
</wfs:GetFeature>

ocourtin avatar Dec 12 '12 18:12 ocourtin

Hi, I guess this could be an issue of my installation. So I'm try-ing to trace the call the buffer_op with the buf variable null-ed.

Can you say me in what file there is the calls for the GetFeature Requests.

Thx, Andrea.

aperi2007 avatar Dec 13 '12 12:12 aperi2007

Another information: the issue come only with a post request. It don't come with a get request.

aperi2007 avatar Dec 13 '12 12:12 aperi2007

You could use valgrind and tinyows debug script to help on this:

./test/unit-test YOUR_POST_REQUEST_FILE_PATH 2

ocourtin avatar Dec 13 '12 17:12 ocourtin

Hi,

it was not so easy for me. However I found something.

I see the issue is in the ows/ows_request.c (at 310 line about)

I can see that before this line of code

/* check if VERSION is set and init Version */ or->version = ows_version_init();

The 'cgi' variable is properly set. I check it with an "assert(cgi)".

After this function (ows_version_init) the 'cgi' variable is null. This happened only when the request is with POST method.

I don't know at now what happened in that function.

aperi2007 avatar Dec 26 '12 16:12 aperi2007

mmhh..

no. The function ows_request_check end correctly. I wrong interpret the flow.

aperi2007 avatar Dec 26 '12 16:12 aperi2007

Perhaps I do a step forward the issue. In the "ows_layer.c"

the function list *ows_layer_list_by_ns_prefix(ows_layer_list * ll, list * layer_name_prefix, buffer * ns_prefix)

in this piece of code:

for (ln = layer_name_prefix->first; ln ; ln = ln->next) { layer_ns_prefix = ows_layer_ns_prefix(ll, ln->value);

seem to have always NULL the "layer_ns_prefix".

Now I need to understand why this is always NULL on a POST request.

aperi2007 avatar Dec 26 '12 20:12 aperi2007

found !

The issue was in the name of the prefix.

My config.xml was using:

<layer ns_prefix='ambiti_amministrativi' ns_uri="http://www.regione.toscana.it/"

The character "_" was not understand from tinyows. When I remove it using

<layer ns_prefix='ambitiamministrativi' ns_uri="http://www.regione.toscana.it/"

It begin to work.

I guess is better open a specific ticket.

aperi2007 avatar Dec 26 '12 21:12 aperi2007

opened the ticket #52

aperi2007 avatar Dec 26 '12 21:12 aperi2007

I found another bug always on the lists of layer. Opened another ticket to explain it.

aperi2007 avatar Dec 26 '12 22:12 aperi2007