olingo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Punith DG (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (OLINGO-999) Cannot add more than one request into ChangSet - thread halts in infinite loop
Date Fri, 19 Aug 2016 08:07:21 GMT

     [ https://issues.apache.org/jira/browse/OLINGO-999?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Punith DG updated OLINGO-999:
    Attachment: $metadata.xml


I have attached a standalone program to reproduce the issue. It is easily reproducible by
adding third batch request into a batch changeset. The problem is exactly what is stated in
the description. Since you developer know in and out of code, I feel it will be easy for you
to isolate the problem and come up with a quick solution.

Meanwhile I'll be looking into this issue. It takes sometime for me understand the code and
As per the some basic research, the piped streams are going in infinite loop since they are
running in a single thread.


As design, when using the two connected pipe streams, it is recommended to pass one stream
to one thread, and the other stream to another thread. The read() and write() calls on the
streams are blocking, meaning if you try to use the same thread to both read and write, this
may result in the thread deadlocking itself.


> Cannot add more than one request into ChangSet - thread halts in infinite loop
> ------------------------------------------------------------------------------
>                 Key: OLINGO-999
>                 URL: https://issues.apache.org/jira/browse/OLINGO-999
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata4-client, odata4-commons
>    Affects Versions: (Java) V4 4.2.0
>            Reporter: Punith DG
>            Priority: Blocker
>              Labels: batch, changeset, thread-safety
>         Attachments: $metadata.xml, BatchTest.java
> I am not able to add more than one request to a batch ChangeSet as the BatchManager has
PipedOutputStream Writer that's causing thread to get into infinite loop.
> Check the below sample code in which I'm trying to add requests. 
> for loop{
> ODataBatchRequest batchRequest = client.getBatchRequestFactory().getBatchRequest("serviceRootURI");
> BatchManager payloadManager = batchRequest.payloadManager();
> ODataChangeset changeset = payloadManager.addChangeset();
> ODataEntityCreateRequest<ClientEntity> createRequest = client.getCUDRequestFactory()
       .getEntityCreateRequest(new URI("serviceRoot"), clientEntity);
> createRequest.setFormat(ContentType.JSON);
> changeset.addRequest(createRequest); // here the thread waits in infinite loop due to
piped streams sync problem.
> }
> The problem is observed in line "request.batch(req, String.valueOf(contentId));" in addRequest()
method of ODataChangesetImpl class.
> It seems a known issue in Java - http://stackoverflow.com/questions/9171632/piped-input-stream-is-getting-locked

This message was sent by Atlassian JIRA

View raw message