jojochuang commented on PR #10765:
URL: https://github.com/apache/ozone/pull/10765#issuecomment-4977279858

   ## Bugbot review
   
   **readFully succeeds at EOF** — 
`hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java:328-338`
 · Severity: high
   
   `readFully` returns `true` when the target offset is at or past the end of 
the block, or when no bytes can be read from the current chunk, instead of 
throwing `EOFException` or otherwise signaling failure. Callers such as 
`OzoneFSInputStream` treat a `true` return as a completed positioned read and 
compute bytes transferred from buffer remaining; an unfilled buffer yields zero 
bytes read while `hasRemaining()` stays true, which can spin forever or return 
silently short reads.
   
   **Positioned read leaks clients** — 
`hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/ChunkInputStream.java:833-851`
 · Severity: high
   
   `getClientAndUpdateBlock` calls `acquireClientForReadData` on every 
positioned `read(long, ByteBuffer)` but never calls `releaseClientForReadData`. 
`BlockInputStream.readFully` uses this path for each chunk segment, so each 
positioned read leaks an xceiver client and its connections.
   
   **readFully checks buffer capacity** — 
`hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/ChunkInputStream.java:824-830`
 · Severity: medium
   
   `readFully` compares the result of `read` against `byteBuffer.capacity()` 
instead of the number of bytes the caller asked to fill 
(`byteBuffer.remaining()` at entry). For a buffer with a non-zero position or a 
limit below capacity, a successful read can incorrectly throw `EOFException`, 
or accept a short read as complete.
   
   **Refresh skipped after first failure** — 
`hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java:217-223`
 · Severity: medium
   
   After the first refresh attempt for a pipeline, `failedPipeline` is set to 
the current `pipelineRef` even when refresh did not obtain new location info. 
Later connectivity failures on the same pipeline skip `refreshBlockInfo` 
entirely, so stale pipeline/token metadata may never be refreshed again during 
retries.
   
   ---
   Generated-by: Cursor Bugbot


-- 
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