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(relay): correctly track associated state of inflight streams #4841

Merged
merged 12 commits into from
Nov 15, 2023

Conversation

thomaseizinger
Copy link
Contributor

@thomaseizinger thomaseizinger commented Nov 13, 2023

Description

In the relay client, we need to track a fair bit of data alongside Futures that are executing within a FuturesSet. In particular, we need to track the channels that connect us the Transport. Using ? within the actual async block of the protocol is crucial for ergonomics but essentially locks us out of passing the channel into the Future itself. Hence, we need to track it outside.

As we can see from #4822, doing so in a separate list is error prone.

We solve this by introducing the FuturesTupleSet type to futures-bounded. This is a variation of FuturesSet that carries a piece of arbitrary data alongside the Future that is executing and returns it back upon completion.

Using this within the relay code reveals another bug where we mistakenly confused a timed out CONNECT request for a timed out RESERVE request.

Fixes: #4822.

Notes & open questions

  • Suggestions for a better name for FuturesTupleSet are welcome.

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

This comment was marked as resolved.

misc/futures-bounded/CHANGELOG.md Outdated Show resolved Hide resolved
protocols/relay/CHANGELOG.md Outdated Show resolved Hide resolved

This comment was marked as resolved.

This comment was marked as resolved.

This comment was marked as resolved.

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

Thank you for debugging!

protocols/relay/src/priv_client/handler.rs Show resolved Hide resolved
@mergify mergify bot merged commit 41da782 into master Nov 15, 2023
71 checks passed
@mergify mergify bot deleted the fix/4822-relay-state branch November 15, 2023 21:52
@dariusc93
Copy link
Member

Thank you for this fix. Can we get a patch release for this?

/CC @mxinden

@thomaseizinger
Copy link
Contributor Author

Thank you for this fix. Can we get a patch release for this?

/CC @mxinden

Sure! I'll make a release in a bit.

@dariusc93
Copy link
Member

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

relay: random crashes due to debug assertion
3 participants