transport: surface data when received non-grpc header, end stream without trailers - #9217
Conversation
If we were collecting non-gRPC response data, finalize the status with whatever body we've buffered so far instead of discarding it. Add tests in both internal/transport_test.go and test/end2end_test.go to test it.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #9217 +/- ##
==========================================
+ Coverage 83.03% 83.14% +0.11%
==========================================
Files 422 422
Lines 34826 34827 +1
==========================================
+ Hits 28917 28958 +41
+ Misses 4407 4381 -26
+ Partials 1502 1488 -14
🚀 New features to boost your workflow:
|
|
I can confirm this works: Thank you for the quick followup! Looking forward to pulling the next release in and enjoying more discoverable error messages. |
Great!!! Thank you so much for your quick followup too! ❤️❤️❤️ |
|
Sorry I forgot update the PR title. |
|
@easwars Any chance this fix could be considered for a cherry-pick into 1.82? I couldn't find a doc with guidelines for cherry-pick requirements - but since I ran into this while debugging a 500 error today I thought it might be worth asking. |
|
@drigz : If we get this reviewed and merged in time before the 1.83 release, which should happen sometime next week, we can consider cherry-picking it. |
|
All issues addressed. Additionally, I removed the redundant seenHeaders channel in |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request ensures that when a non-gRPC response is followed by an empty DATA frame with END_STREAM, the client correctly surfaces the original non-gRPC error instead of discarding the collected buffer and returning an internal error. This is achieved by refactoring the handleData method in http2_client.go to process non-gRPC status checks outside of the data size block and only processing data frames when size > 0. Corresponding unit and end-to-end tests have been added and updated to verify this behavior. There are no review comments to address, and the changes look solid.
arjan-bal
left a comment
There was a problem hiding this comment.
LGTM! Adding a second reviewer.
|
@chengxilo : Thanks for your contribution! |
Follow up: #8929
Related to: #7406 (comment) . I don't have the captured packages for reference. But according to the code, I think what I fixed is the only code path that produces codes.Internal / "server closed the stream without sending trailers" when nonGRPCStatus is set.
With this change, if we were collecting non-gRPC response data, and received an end of stream while there is no trailers, finalize the status with whatever body we've buffered so far instead of discarding it. I added tests in both
internal/transport_test.goandtest/end2end_test.goto test it.RELEASE NOTES: