[
https://issues.apache.org/jira/browse/OLINGO-1254?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Fernando Mendel updated OLINGO-1254:
------------------------------------
Description:
Hey,
we are using the following dependencies from Olingo:
{code:xml}
<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>
{code}
When doing two assyncronous requests to GET data from OData, sometimes it
works, sometimes it does not.
I have generated the following test code in javascript:
{code: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'John%20Mendel'");
b =
prepareData("http://localhost:8080/OData/V2/CareCorner.svc/PackageDTOMocks?%24filter=RecipientName%20eq%20'Karl%20Frank'");
a.send(null);
b.send(null);
{code}
it sends two get requests with different filters.
The behavior is a bit non deterministic, a already seen the following
behaviors to happen:
* Both requests return the same output (same filter condition)
* One works the the other returns a null pointer
* One works and the other returns:
{code:java}
{"httpStatus":"INTERNAL_SERVER_ERROR","exceptionKey":"SAPException(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)]."}
{code}
I believe the cause is that *parameterizedMap* is built from a static method.
class *JPAQueryBuilder*, method *buildQuery*
{code:java}
Map<String, Map<Integer, Object>> parameterizedMap =
ODataParameterizedWhereExpressionUtil.
getParameterizedQueryMap();
{code}
Filter query output example:
{code:xml}
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xml:base="http://localhost:8080/OData/V2/CareCorner.svc/"><id>http://localhost:8080/OData/V2/CareCorner.svc/PackageDTOMocks</id><title
type="text">PackageDTOMocks</title><updated>2018-04-03T16:25:40.161Z</updated><author><name></name></author><link
href="PackageDTOMocks" rel="self"
title="PackageDTOMocks"></link><entry><id>http://localhost:8080/OData/V2/CareCorner.svc/PackageDTOMocks('794687097541')</id><title
type="text">PackageDTOMocks</title><updated>2018-04-03T16:25:40.161Z</updated><category
term="LocalPersistenceUnit.PackageDTOMock"
scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"></category><link
href="PackageDTOMocks('794687097541')" rel="edit"
title="PackageDTOMock"></link><content
type="application/xml"><m:properties><d:AdultSignatureRequired>false</d:AdultSignatureRequired><d:DangerousGood>false</d:DangerousGood><d:RecipientName>Karl
Mendel</d:RecipientName><d:ShippingType>EXPRESS</d:ShippingType><d:TrackingNumber>794687097541</d:TrackingNumber></m:properties></content></entry></feed>
{code}
I'm setting this as critical because there is no way to release Olingo in an
production application with this issue when sending parallel requests.
was:
Hey,
we are using the following dependencies from Olingo:
{code:xml}
<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>
{code}
One servlet is declared and is working fine:
{code:java}
@Bean
public ODataServlet odataServlet() {
return new ODataServlet();
}
@Bean
public ServletRegistrationBean odataServletRegistrationBean(){
ServletRegistrationBean servlet = new
ServletRegistrationBean(odataServlet(),"/OData/V2/CareCorner.svc/*");
servlet.setLoadOnStartup(3);
servlet.addInitParameter("javax.ws.rs.Application",
"org.apache.olingo.odata2.core.rest.app.ODataApplication");
servlet.addInitParameter("org.apache.olingo.odata2.service.factory",
jpaFactoryClass);
return servlet;
}
{code}
When doing two assyncronous requests to GET data from OData, sometimes it
works, sometimes it does not.
I have generated the following test code in javascript:
{code: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'John%20Mendel'");
b =
prepareData("http://localhost:8080/OData/V2/CareCorner.svc/PackageDTOMocks?%24filter=RecipientName%20eq%20'Karl%20Frank'");
a.send(null);
b.send(null);
{code}
it sends two get requests with different filters.
The behavior is a bit non deterministic, a already seen the following
behaviors to happen:
* Both requests return the same output (same filter condition)
* One works the the other returns a null pointer
* One works and the other returns:
{code:java}
{"httpStatus":"INTERNAL_SERVER_ERROR","exceptionKey":"SAPException(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)]."}
{code}
I believe the cause is that *parameterizedMap* is built from a static method.
class *JPAQueryBuilder*, method *buildQuery*
{code:java}
Map<String, Map<Integer, Object>> parameterizedMap =
ODataParameterizedWhereExpressionUtil.
getParameterizedQueryMap();
{code}
Filter query output example:
{code:xml}
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xml:base="http://localhost:8080/OData/V2/CareCorner.svc/"><id>http://localhost:8080/OData/V2/CareCorner.svc/PackageDTOMocks</id><title
type="text">PackageDTOMocks</title><updated>2018-04-03T16:25:40.161Z</updated><author><name></name></author><link
href="PackageDTOMocks" rel="self"
title="PackageDTOMocks"></link><entry><id>http://localhost:8080/OData/V2/CareCorner.svc/PackageDTOMocks('794687097541')</id><title
type="text">PackageDTOMocks</title><updated>2018-04-03T16:25:40.161Z</updated><category
term="LocalPersistenceUnit.PackageDTOMock"
scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"></category><link
href="PackageDTOMocks('794687097541')" rel="edit"
title="PackageDTOMock"></link><content
type="application/xml"><m:properties><d:AdultSignatureRequired>false</d:AdultSignatureRequired><d:DangerousGood>false</d:DangerousGood><d:RecipientName>Karl
Mendel</d:RecipientName><d:ShippingType>EXPRESS</d:ShippingType><d:TrackingNumber>794687097541</d:TrackingNumber></m:properties></content></entry></feed>
{code}
I'm setting this as critical because there is no way to release Olingo in an
production application with this issue when sending parallel requests.
> Issue when sending requests in parallel
> ---------------------------------------
>
> Key: OLINGO-1254
> URL: https://issues.apache.org/jira/browse/OLINGO-1254
> Project: Olingo
> Issue Type: Bug
> Components: odata2-jpa
> Reporter: Fernando Mendel
> Priority: Critical
>
> Hey,
> we are using the following dependencies from Olingo:
>
> {code:xml}
> <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>
> {code}
>
>
> When doing two assyncronous requests to GET data from OData, sometimes it
> works, sometimes it does not.
> I have generated the following test code in javascript:
> {code: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'John%20Mendel'");
>
> b =
> prepareData("http://localhost:8080/OData/V2/CareCorner.svc/PackageDTOMocks?%24filter=RecipientName%20eq%20'Karl%20Frank'");
>
>
> a.send(null);
> b.send(null);
> {code}
>
> it sends two get requests with different filters.
>
> The behavior is a bit non deterministic, a already seen the following
> behaviors to happen:
> * Both requests return the same output (same filter condition)
> * One works the the other returns a null pointer
> * One works and the other returns:
> {code:java}
> {"httpStatus":"INTERNAL_SERVER_ERROR","exceptionKey":"SAPException(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)]."}
> {code}
> I believe the cause is that *parameterizedMap* is built from a static method.
> class *JPAQueryBuilder*, method *buildQuery*
> {code:java}
> Map<String, Map<Integer, Object>> parameterizedMap =
> ODataParameterizedWhereExpressionUtil.
> getParameterizedQueryMap();
> {code}
> Filter query output example:
> {code:xml}
> <?xml version="1.0" encoding="utf-8"?><feed
> xmlns="http://www.w3.org/2005/Atom"
> xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
> xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
> xml:base="http://localhost:8080/OData/V2/CareCorner.svc/"><id>http://localhost:8080/OData/V2/CareCorner.svc/PackageDTOMocks</id><title
>
> type="text">PackageDTOMocks</title><updated>2018-04-03T16:25:40.161Z</updated><author><name></name></author><link
> href="PackageDTOMocks" rel="self"
> title="PackageDTOMocks"></link><entry><id>http://localhost:8080/OData/V2/CareCorner.svc/PackageDTOMocks('794687097541')</id><title
>
> type="text">PackageDTOMocks</title><updated>2018-04-03T16:25:40.161Z</updated><category
> term="LocalPersistenceUnit.PackageDTOMock"
> scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"></category><link
> href="PackageDTOMocks('794687097541')" rel="edit"
> title="PackageDTOMock"></link><content
> type="application/xml"><m:properties><d:AdultSignatureRequired>false</d:AdultSignatureRequired><d:DangerousGood>false</d:DangerousGood><d:RecipientName>Karl
>
> Mendel</d:RecipientName><d:ShippingType>EXPRESS</d:ShippingType><d:TrackingNumber>794687097541</d:TrackingNumber></m:properties></content></entry></feed>
> {code}
>
> I'm setting this as critical because there is no way to release Olingo in an
> production application with this issue when sending parallel requests.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)