Skip to content

Conversation

@easwars
Copy link
Contributor

@easwars easwars commented Jan 13, 2026

Fixes #835

This PR fixes the behavior of the client to send a RST_STREAM when it receives an END_STREAM from the server when the client-side of the stream is still open. It also adds tests for both the client and server side behaviors of sending RST_STREAM when they receive an END_STREAM from their peer.

RELEASE NOTES:

  • transport: fix a bug in the client where it was failing to send a RST_STREAM upon receiving an END_STREAM from the server when the stream was still open

@easwars easwars requested a review from arjan-bal January 13, 2026 23:42
@easwars easwars added this to the 1.79 Release milestone Jan 13, 2026
@easwars easwars requested a review from dfawley January 13, 2026 23:42
@codecov
Copy link

codecov bot commented Jan 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.20%. Comparing base (25dbb81) to head (65cb23c).
⚠️ Report is 12 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8832      +/-   ##
==========================================
- Coverage   83.29%   83.20%   -0.09%     
==========================================
  Files         414      414              
  Lines       32753    32721      -32     
==========================================
- Hits        27280    27226      -54     
- Misses       4070     4079       +9     
- Partials     1403     1416      +13     
Files with missing lines Coverage Δ
internal/transport/http2_client.go 93.01% <100.00%> (+0.49%) ⬆️

... and 36 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@arjan-bal arjan-bal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC, the situation mentioned in #835 is not covered. Specifically, the server sends trailers with the EOS flag but does not send an RST_STREAM frame. The client is expected to send an RST_STREAM to inform proxies about the stream closure.

@arjan-bal arjan-bal assigned easwars and unassigned arjan-bal Jan 14, 2026
Copy link
Contributor Author

@easwars easwars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC, the situation mentioned in #835 is not covered. Specifically, the server sends trailers with the EOS flag but does not send an RST_STREAM frame. The client is expected to send an RST_STREAM to inform proxies about the stream closure.

Added a test for it, and combined all three scenarios for the client into a single table driven test.

@easwars easwars assigned arjan-bal and unassigned easwars Jan 15, 2026
Copy link
Contributor

@arjan-bal arjan-bal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@arjan-bal arjan-bal removed their assignment Jan 16, 2026
Copy link
Member

@dfawley dfawley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would probably be a good idea to write a test that ensures unread messages can still be read when this happens. I.e.:

  • Start stream; client sits idle for now
  • Server sends a few messages and a status
  • After the server has done this and we know the client has finished calling closeStream (somehow...maybe the server closes the connection (gracefully?) and we check the connectivity state?), client then reads the messages out of the stream.

@easwars
Copy link
Contributor Author

easwars commented Jan 21, 2026

It would probably be a good idea to write a test that ensures unread messages can still be read when this happens. I.e.:

  • Start stream; client sits idle for now
  • Server sends a few messages and a status
  • After the server has done this and we know the client has finished calling closeStream (somehow...maybe the server closes the connection (gracefully?) and we check the connectivity state?), client then reads the messages out of the stream.

Done. I added a test to to verify that the client can still read unread messages after sending a RST_STREAM upon receiving an EOS from the server.

I also refactored the existing table-driven test into individual, clearer test functions using a shared helper as the test logic was getting more and more complicated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

transport: add tests to verify that client/server sends RST_STREAM(NO_ERROR) if not half-closed when receiving trailers

4 participants