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(iroh-relay): removes deadlock in Clients #3099

Merged
merged 7 commits into from
Jan 7, 2025
Merged

Conversation

ramfox
Copy link
Contributor

@ramfox ramfox commented Jan 7, 2025

Description

Remove the deadlock that was a bit hidden due to DashMap.

Added client parameter to unregister to explicitly drop before attempting to call into the clients DashMap again.

Notes & open questions

The warn log for stream termination seems a little fear-mongering, but I'm not sure the best way to "downgrade" this, as we seem to rely on this error in tests like endpoint_relay_connect_loop. Ended up leaving it as is.

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.

“ramfox” added 2 commits January 6, 2025 23:26
Also downgrades "stream terminated" from a `warn` to a `trace`, so we don not get an warning everytime a connection to the relay closes
Copy link

github-actions bot commented Jan 7, 2025

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3099/docs/iroh/

Last updated: 2025-01-07T18:24:43Z

Copy link

github-actions bot commented Jan 7, 2025

Netsim report & logs for this PR have been generated and is available at: LOGS
This report will remain available for 3 days.

Last updated for commit: d50553d

@ramfox ramfox requested review from dignifiedquire and flub January 7, 2025 05:31
@Arqu
Copy link
Collaborator

Arqu commented Jan 7, 2025

Can confirm this fixes the issue for me.

Copy link
Contributor

@flub flub left a comment

Choose a reason for hiding this comment

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

LGTM but let's wait for @dignifiedquire as he wrote this I think

iroh-relay/src/server/client.rs Outdated Show resolved Hide resolved
iroh-relay/src/server/clients.rs Outdated Show resolved Hide resolved
@ramfox
Copy link
Contributor Author

ramfox commented Jan 7, 2025

Okay, added a client param to unregister.

The thing that really sold it for me was that it is now easy for this deadlock to show up in a test if there are future refactors. It will be difficult to explicitly remove the drop and change the test_clients test without realizing that you are removing important protections.

@ramfox ramfox requested a review from flub January 7, 2025 18:08
@ramfox ramfox added this pull request to the merge queue Jan 7, 2025
Merged via the queue into main with commit c650ea8 Jan 7, 2025
28 checks passed
@ramfox ramfox deleted the ramfox/relay-deadlock branch January 7, 2025 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

4 participants