Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reliably queue MAX_DATA frames #4844

Merged
merged 1 commit into from
Jan 8, 2025
Merged

reliably queue MAX_DATA frames #4844

merged 1 commit into from
Jan 8, 2025

Conversation

marten-seemann
Copy link
Member

We need to make sure that a MAX_DATA frame actually triggers the packing of a new packet (with which it can then be sent out). Otherwise, reading from a stream might get the MAX_DATA frame queued, but if no packet is sent, it's never sent out to the peer, potentially leading to a deadlock of the connection.

Copy link

codecov bot commented Jan 7, 2025

Codecov Report

Attention: Patch coverage is 87.09677% with 4 lines in your changes missing coverage. Please review.

Project coverage is 83.69%. Comparing base (3cb5f3e) to head (3c72700).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
receive_stream.go 86.96% 3 Missing ⚠️
connection.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4844   +/-   ##
=======================================
  Coverage   83.69%   83.69%           
=======================================
  Files         149      149           
  Lines       16078    16087    +9     
=======================================
+ Hits        13456    13464    +8     
- Misses       2091     2092    +1     
  Partials      531      531           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@marten-seemann marten-seemann requested a review from sukunrt January 7, 2025 06:44
@marten-seemann marten-seemann merged commit 5a6187c into master Jan 8, 2025
37 checks passed
@marten-seemann marten-seemann deleted the queue-max-data branch January 8, 2025 06:39
Copy link
Collaborator

@MarcoPolo MarcoPolo left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -205,9 +207,13 @@ func (s *receiveStream) readImpl(p []byte) (bool, int, error) {
// when a RESET_STREAM was received, the flow controller was already
// informed about the final byteOffset for this stream
if !s.cancelledRemotely {
if queueMaxStreamData := s.flowController.AddBytesRead(protocol.ByteCount(m)); queueMaxStreamData {
hasStream, hasConn := s.flowController.AddBytesRead(protocol.ByteCount(m))
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: may as well assign these to your vars hasXWindowUpdate

Copy link
Member Author

Choose a reason for hiding this comment

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

Depends on how the loop executes / returns. I think it should be fine, but I wanted to be very explicit about not setting value from true back to false.

@lidel lidel mentioned this pull request Jan 23, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

potential connection deadlock due to missing send triggering when MAX_DATA is available
2 participants