sodonnel opened a new pull request, #10430:
URL: https://github.com/apache/ozone/pull/10430

   ## What changes were proposed in this pull request?
   
   In StreamBlockInputStream.poll() if checks `future.isDone()` before draining 
the queue:
   
   ```
     while (true) {
         checkError();
         if (future.isDone()) {   // <- checked FIRST
             return null;         // returns even if queue has items
         }
         proto = responseQueue.poll(pollTimeoutNanos, TimeUnit.NANOSECONDS);
         ...
     }
   ```
   
   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()`.
   
   ## What is the link to the Apache JIRA
   
   [HDDS-15479
   ](https://issues.apache.org/jira/browse/HDDS-15479)
   
   ## How was this patch tested?
   
   Unit test added to reproduce the problem and validate the fix.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to