riesgos / async

0 stars 0 forks source link

WPS doesn't return references correctly if it's not been re-booted. #41

Closed MichaelLangbein closed 1 year ago

MichaelLangbein commented 1 year ago

Summary

Noticed when ...

Downstream, this causes errors like the following when services further down the line attempt to make use of data from that wrong url http://localhost:8080/wps/RetrieveResultServlet?id= (from riesgos-wps logs):

2023-01-13 17:02:53,892 [pool-7-thread-4] INFO  org.n52.wps.server.request.InputHandler: Looking for matching Parser ... schema: "null", mimeType: "text/xml", encoding: "null"
2023-01-13 17:02:53,892 [pool-7-thread-4] INFO  org.n52.wps.io.ParserFactory: Matching parser found: org.n52.wps.io.datahandler.parser.GenericXMLDataParser@191033c5
2023-01-13 17:02:53,898 [pool-7-thread-4] ERROR org.n52.wps.io.datahandler.parser.GenericXMLDataParser: Could not parse inputstream as XMLObject.
org.apache.xmlbeans.XmlException: error: Unexpected element: CDATA
    at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3511) ~[xmlbeans-2.6.0.jar:na]
    at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1277) ~[xmlbeans-2.6.0.jar:na]
    at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1264) ~[xmlbeans-2.6.0.jar:na]
    at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345) ~[xmlbeans-2.6.0.jar:na]
    at org.apache.xmlbeans.XmlObject$Factory.parse(XmlObject.java:688) ~[xmlbeans-2.6.0.jar:2.6.0-r1364789]
    at org.n52.wps.io.datahandler.parser.GenericXMLDataParser.parse(GenericXMLDataParser.java:61) [52n-wps-io-impl-4.0.0-beta.10.jar:na]
    at org.n52.wps.io.datahandler.parser.GenericXMLDataParser.parse(GenericXMLDataParser.java:40) [52n-wps-io-impl-4.0.0-beta.10.jar:na]
    at org.n52.wps.server.request.InputHandler.handleComplexValueReference(InputHandler.java:1464) [52n-wps-server-4.0.0-beta.10.jar:na]
    at org.n52.wps.server.request.InputHandler.<init>(InputHandler.java:228) [52n-wps-server-4.0.0-beta.10.jar:na]
    at org.n52.wps.server.request.InputHandler.<init>(InputHandler.java:101) [52n-wps-server-4.0.0-beta.10.jar:na]
    at org.n52.wps.server.request.InputHandler$Builder.build(InputHandler.java:134) [52n-wps-server-4.0.0-beta.10.jar:na]
    at org.n52.wps.server.request.ExecuteRequestV200.call(ExecuteRequestV200.java:200) [52n-wps-server-4.0.0-beta.10.jar:na]
    at org.n52.wps.server.request.ExecuteRequestV200.call(ExecuteRequestV200.java:71) [52n-wps-server-4.0.0-beta.10.jar:na]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_342]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_342]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_342]
    at java.lang.Thread.run(Thread.java:750) [na:1.8.0_342]
Caused by: org.xml.sax.SAXParseException: Unexpected element: CDATA
    at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.reportFatalError(Piccolo.java:1038) ~[xmlbeans-2.6.0.jar:na]
    at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:723) ~[xmlbeans-2.6.0.jar:na]
    at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3479) ~[xmlbeans-2.6.0.jar:na]
    ... 16 common frames omitted

To reproduce:

  1. Send a request to e.g. assetmaster:

    <wps:Execute xmlns:wps="http://www.opengis.net/wps/2.0" xmlns:ows="http://www.opengis.net/ows/2.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/2.0 http://schemas.opengis.net/wps/2.0/wps.xsd" response="document" mode="sync" service="WPS" version="2.0.0">
    <ows:Identifier>org.n52.gfz.riesgos.algorithm.impl.AssetmasterProcess</ows:Identifier>
    <wps:Input id="lonmin">
        <wps:Data mimeType="text/xml">
            <wps:LiteralValue>-71.8</wps:LiteralValue>
        </wps:Data>
    </wps:Input>
    <wps:Input id="lonmax">
        <wps:Data mimeType="text/xml">
            <wps:LiteralValue>-71.4</wps:LiteralValue>
        </wps:Data>
    </wps:Input>
    <wps:Input id="latmin">
        <wps:Data mimeType="text/xml">
            <wps:LiteralValue>-33.2</wps:LiteralValue>
        </wps:Data>
    </wps:Input>
    <wps:Input id="latmax">
        <wps:Data mimeType="text/xml">
            <wps:LiteralValue>-35.0</wps:LiteralValue>
        </wps:Data>
    </wps:Input>
    <wps:Input id="schema">
        <wps:Data mimeType="text/xml">
            <wps:LiteralValue>SARA_v1.0</wps:LiteralValue>
        </wps:Data>
    </wps:Input>
    <wps:Input id="assettype">
        <wps:Data mimeType="text/xml">
            <wps:LiteralValue>res</wps:LiteralValue>
        </wps:Data>
    </wps:Input>
    <wps:Input id="querymode">
        <wps:Data mimeType="text/xml">
            <wps:LiteralValue>intersects</wps:LiteralValue>
        </wps:Data>
    </wps:Input>
    <wps:Input id="model">
        <wps:Data mimeType="text/xml">
            <wps:LiteralValue>ValpCVTBayesian</wps:LiteralValue>
        </wps:Data>
    </wps:Input>
    <wps:Output id="selectedRowsGeoJson" transmission="reference" mimeType="application/json" encoding="UTF-8"></wps:Output>
    </wps:Execute>
  2. The result contains a reference to a file:

    <wps:Result xmlns:wps="http://www.opengis.net/wps/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlin="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/2.0 http://schemas.opengis.net/wps/2.0/wps.xsd">
    <wps:JobID>ac879c1b-0959-491f-9e0e-4d097147c2b2</wps:JobID>
    <wps:Output id="selectedRowsGeoJson">
        <wps:Reference encoding="UTF-8" mimeType="application/json" xlin:href="http://localhost:8080/wps/RetrieveResultServlet?id=ac879c1b-0959-491f-9e0e-4d097147c2b2selectedRowsGeoJson.39662d40-fc34-4af4-a31f-635abc5d8af0"/>
    </wps:Output>
    </wps:Result>
  3. This file will be stored in the filestorage. Inspecting that file we find the contents: {"timestamp":"2023-01-13T17:02:53.101+00:00","status":404,"error":"Not Found","path":"/wps/RetrieveResultServlet"}

MichaelLangbein commented 1 year ago

I've tried restarting wps via the tomcat-manager; but the process does not come up again after being deactivated once. Stopping and starting the container riesgos-wps does the trick, though!

MichaelLangbein commented 1 year ago

Closing: resolved with #60