Uploaded image for project: 'Olingo'
  1. Olingo
  2. OLINGO-1254

Issue when sending requests in parallel

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • None
    • None
    • odata2-jpa
    • None

    Description

      Hey,

      We are using the following dependencies from Olingo: 

      <dependency>
      <groupId>org.apache.olingo</groupId>
      <artifactId>olingo-odata2-api</artifactId>
      <version>2.0.10</version>
      </dependency>
      <dependency>
      <groupId>org.apache.olingo</groupId>
      <artifactId>olingo-odata2-core</artifactId>
      <version>2.0.10</version>
      </dependency>
      <dependency>
      <groupId>org.apache.olingo</groupId>
      <artifactId>olingo-odata2-jpa-processor-api</artifactId>
      <version>2.0.10</version>
      </dependency>
      <dependency>
      <groupId>org.apache.olingo</groupId>
      <artifactId>olingo-odata2-api-annotation</artifactId>
      <version>2.0.10</version>
      </dependency>
      <dependency>
      <groupId>org.apache.olingo</groupId>
      <artifactId>olingo-odata2-jpa-processor-core</artifactId>
      <version>2.0.10</version>
      </dependency>
      

       

      When doing two assyncronous requests GET data from OData with different filters, sometimes it works, sometimes it does not.

      Like below queries:

      "http://localhost:8080/OData/V2/CareCorner.svc/PackageDTOMocks?%24filter=RecipientName%20eq%20'John%20Frank'"
      "http://localhost:8080/OData/V2/CareCorner.svc/PackageDTOMocks?%24filter=RecipientName%20eq%20'Karl%20Mendel'"
      

      The behavior is a bit non deterministic, I already have seen the following behaviors:

      • Return the first filter result twice
      • Null pointer
      • The following exception:
        {"httpStatus":"INTERNAL_SERVER_ERROR","exceptionKey":"Exception(org.hibernate.QueryException)","exceptionMessage":"An unhandled exception happened: Not all named parameters have been set: [2] [SELECT E1 FROM PackageDTOMock E1 WHERE (E1.recipientName = ?2)]."}
        

      I have generated the following test code in javascript:

      function prepareData(sUrl){ var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } }); xhr.open("GET", sUrl); xhr.setRequestHeader("authorization", "Basic YWRtaW46YWRtaW4="); return xhr; }
       
      a = prepareData("http://localhost:8080/OData/V2/CareCorner.svc/PackageDTOMocks?%24filter=RecipientName%20eq%20'Karl%20Mendel'");
       
      b = prepareData("http://localhost:8080/OData/V2/CareCorner.svc/PackageDTOMocks?%24filter=RecipientName%20eq%20'John%20Frank'"); 
       
      a.send(null); 
      b.send(null);
      

      The issue seems to lie on class JPAQueryBuilder, method buildQuery.
      The parameter parameterizedMap is filled from an static method getParameterizedQueryMap().

          Map<String, Map<Integer, Object>> parameterizedMap = ODataParameterizedWhereExpressionUtil.
              getParameterizedQueryMap();
      

       

      I'm setting this as critical because we are facing this in two different projects and there is no way to release Olingo in an production application with this issue when sending parallel requests.

      Attachments

        Activity

          People

            Unassigned Unassigned
            flmendel Fernando Mendel
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: