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

Explicitly track whether FIN has been acknowledged #441

Merged
merged 1 commit into from
Jan 7, 2024

Conversation

jlaine
Copy link
Contributor

@jlaine jlaine commented Jan 7, 2024

A stream's sender part is only finished if all the data and the FIN have been acknowledged. Tracking the acknowledged data ranges is not sufficient to know whether the FIN has been acknowledged too, as the FIN may have been sent on its own. To fix this we need to explicitly keep track of whether the frame containing the FIN was acknowledged.

We also:

  • Remove a bogus assignment of QuicStreamSender.send_buffer_empty, this should have been QuicStreamSender.buffer_is_empty.
  • Only set buffer_is_empty to False when data or a FIN have been lost. This saves useless calls to QuicStreamSender.get_frame().

This is an alternative to #439

Copy link

codecov bot commented Jan 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5772246) 100.00% compared to head (506c655) 100.00%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #441   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           25        25           
  Lines         4864      4872    +8     
=========================================
+ Hits          4864      4872    +8     

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

@jlaine jlaine changed the title Do not swallow FIN frames without data (fixes: #439) Do not swallow FIN frames without data Jan 7, 2024
@jlaine
Copy link
Contributor Author

jlaine commented Jan 7, 2024

@mhils Could you confirm this fixes the issue you encountered?

I have naturally added you as a co-author!

@jlaine jlaine force-pushed the stream-fin-fix branch 2 times, most recently from 98e7bd0 to 84d4d48 Compare January 7, 2024 01:38
@jlaine jlaine changed the title Do not swallow FIN frames without data Explicitly track whether FIN has been acknowledged Jan 7, 2024
A stream's sender part is only finished if all the data and the FIN have
been acknowledged. Tracking the acknowledged data ranges is not
sufficient to know whether the FIN has been acknowledged too, as the FIN
may have been sent on its own. To fix this we need to explicitly keep
track of whether the frame containing the FIN was acknowledged.

We also:

- Remove a bogus assignment of `QuicStreamSender.send_buffer_empty`,
  this should have been `QuicStreamSender.buffer_is_empty`.
- Only set `buffer_is_empty` to `False` when data or a FIN have been
  lost. This saves useless calls to `QuicStreamSender.get_frame()`.

Co-authored-by: Maximilian Hils <[email protected]>
@jlaine jlaine merged commit 9909899 into aiortc:main Jan 7, 2024
29 checks passed
@jlaine jlaine deleted the stream-fin-fix branch January 7, 2024 02:10
@mhils
Copy link
Contributor

mhils commented Jan 7, 2024

This looks fantastic, thanks so much! 😃 🍰

@jlaine
Copy link
Contributor Author

jlaine commented Jan 7, 2024

This looks fantastic, thanks so much! 😃 🍰

Cool! This is available from PyPI in version 0.9.25 😃

@jlaine
Copy link
Contributor Author

jlaine commented Jan 7, 2024

Oh also, this made me dig a little deeper and I found a potential issue related to RESET, fixed in #444

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.

2 participants