Repository navigation
transport: return unexpected EOF for partial reads - #9204
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9204 +/- ##
==========================================
+ Coverage 87.47% 87.53% +0.06%
==========================================
Files 429 429
Lines 30644 30650 +6
==========================================
+ Hits 26805 26829 +24
+ Misses 3839 3820 -19
- Partials 0 1 +1
🚀 New features to boost your workflow:
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request modifies ReadMessageHeader in internal/transport/transport.go to track the total bytes read across multiple iterations using a new bytesRead variable, ensuring io.ErrUnexpectedEOF is correctly returned if a partial header is read before EOF. A new unit test, TestReadMessageHeaderPartialHeaderEOF, is added to verify this behavior. The reviewer noted that the test method shadows its receiver variable s with a local variable of the same name, and suggested renaming the local variable to stream to improve code clarity and maintainability.
|
Thanks @buger for the contribution, can you please address the comments once? |
26d88f7 to
472254d
Compare
|
Thanks @mbissa, I updated this PR to address the review comments. Changes applied:
Local validation passed: go test ./internal/transport -run '^Test/ReadMessageHeader' -count=1
git diff --check |
|
This PR is labeled as requiring an update from the reporter, and no update has been received after 6 days. If no update is provided in the next 7 days, this issue will be automatically closed. |
|
@mbissa, I have now replied directly to both review threads and resolved them after re-verifying the requested changes in 472254d. The full Could you please re-review when convenient and clear |
easwars
left a comment
There was a problem hiding this comment.
Apologies for the delay in reviewing this change.
|
This PR is labeled as requiring an update from the reporter, and no update has been received after 6 days. If no update is provided in the next 7 days, this issue will be automatically closed. |
|
@easwars, I addressed both review comments and replied inline. The partial-message read now uses cumulative progress so EOF after prior bytes becomes The branch is now current with |
|
Thanks for your contribution, @buger |
Fixes #9200
Track cumulative bytes read while filling a gRPC message header or body. If EOF occurs after any partial progress, return
io.ErrUnexpectedEOFeven when the final read call itself returned zero bytes. Preserve plainio.EOFwhen EOF occurs before any data is read.Regression tests split partial headers and bodies from EOF across separate receive-buffer messages. They verify that partial reads return
io.ErrUnexpectedEOFwhile zero-progress reads retainio.EOF.RELEASE NOTES:
io.ErrUnexpectedEOFafter partial data is received.