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

Fix closing pending frames #194

Merged
merged 4 commits into from
Oct 23, 2024
Merged

Conversation

turuslan
Copy link
Contributor

When yamux connection is closing it should:

  • Send pending frames.
  • Send GoAway frame.
  • Close underlying connection.

But test showed that pending frames from stream_receivers and GoAway frame were not sent.

Commits introducing this bug:

  • 61003c5 replaced VecDeque with Option,
    which caused loss of pending frames,
    because only last pending frame was stored in Option
  • 297e9eb reordered sending and collecting pending frames,
    trying to fix loss of pending frames.
  • 2867280 reverted 61003c5 Option back to VecDeque,
    so all pending frames are stored again.
  • However 297e9eb was not reverted,
    so pending frames are collected,
    but not sent.

This PR provides test to reproduce it, and reverts 297e9eb and af8f693 to fix it.

Copy link
Member

@jxs jxs left a comment

Choose a reason for hiding this comment

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

Thanks for this! Yeah I overlooked that DrainingStreamReceiver pushes frames back to the end of the queue.
Will release a patch version with this fix later on

yamux/src/connection/closing.rs Outdated Show resolved Hide resolved
yamux/src/connection/closing.rs Outdated Show resolved Hide resolved
yamux/src/connection/closing.rs Outdated Show resolved Hide resolved
@jxs jxs merged commit 7063268 into libp2p:master Oct 23, 2024
1 check passed
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