Stephen O'Donnell created HDDS-15479:
----------------------------------------

             Summary: Potential for final chunk to not be read at the end of 
the stream
                 Key: HDDS-15479
                 URL: https://issues.apache.org/jira/browse/HDDS-15479
             Project: Apache Ozone
          Issue Type: Sub-task
            Reporter: Stephen O'Donnell
            Assignee: Stephen O'Donnell


In StreamBlockInputStream.poll() if checks `future.isDone()` before draining 
the queue:

{code}
  while (true) {
      checkError();
      if (future.isDone()) {   // <- checked FIRST
          return null;         // returns even if queue has items
      }
      proto = responseQueue.poll(pollTimeoutNanos, TimeUnit.NANOSECONDS);
      ...
  }
{code}

If the gRPC thread delivers onNext() (adds an item to the queue) and then 
immediately calls onCompleted() (marks the future done) between two iterations 
of the polling loop, the queued item is silently dropped. This can cause 
partial reads —
  the data was delivered by the server but never consumed by the client. The 
fix is to drain the queue before checking isDone().



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to