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(snownet): replace Allocation if credentials to relay change #3590

Merged

Conversation

thomaseizinger
Copy link
Member

When a relay restarts, its credentials change but the socket we use to connect to it might not. Because we upsert Allocations within a snownet::Node based on the socket, such a change is currently not picked up.

Instead, we now check whether an existing allocation uses the same credentials and if it doesn't we throw the old one away and use the new one instead.

Copy link

vercel bot commented Feb 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
firezone ⬜️ Ignored (Inspect) Visit Preview Feb 7, 2024 9:21pm

Copy link

github-actions bot commented Feb 7, 2024

Terraform Cloud Plan Output

Plan: 8 to add, 7 to change, 8 to destroy.

Terraform Cloud Plan

Comment on lines +845 to 848
if existing.is_some() {
tracing::info!(address = %server, "Replaced existing allocation because credentials to TURN server changed");
} else {
tracing::info!(address = %server, "Added new TURN server");
}
Copy link
Member Author

@thomaseizinger thomaseizinger Feb 7, 2024

Choose a reason for hiding this comment

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

I started a discussion with the str0m maintainers on whether we should call invalidate_candidate here on all agents and perhaps trigger an ICE restart. it could be that we are just removing the nominated candidate pair and thus need to trigger an ICE restart but at present, invalidate_candidate doesn't tell me.

Discussion is here: https://str0m.zulipchat.com/#narrow/stream/377845-general/topic/invalidating-candidates

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't have to block this PR on that though. If a relay restarts, the connections won't work anymore anyway so this is just an optimisation to perhaps rescue some of the connections through an ICE restart instead of having to fail the connection via the tunnel.

Copy link

github-actions bot commented Feb 7, 2024

Performance Test Results: direct-perf

TCP

Direction Received/s Sent/s Retransmits
Client to Server 131.8 MiB (+2%) 132.2 MiB (+2%) 92 (-37%)
Server to Client 87.0 MiB (-5%) 88.7 MiB (-5%) 323 (+71%)

UDP

Direction Total/s Jitter Lost
Client to Server 250.0 MiB (+0%) 0.03ms (-90%) 67.21% (+3%)
Server to Client 250.0 MiB (-0%) 0.28ms (-22%) 44.09% (+14%)

Copy link

github-actions bot commented Feb 7, 2024

Performance Test Results: relayed-perf

TCP

Direction Received/s Sent/s Retransmits
Client to Server 39.7 MiB (+1%) 39.8 MiB (+1%) 43 (+65%)
Server to Client 62.5 MiB (-1%) 62.5 MiB (-3%) 75 (-23%)

UDP

Direction Total/s Jitter Lost
Client to Server 250.0 MiB (+0%) 0.22ms (+16%) 75.34% (-2%)
Server to Client 250.0 MiB (-0%) 0.38ms (+75%) 96.20% (+0%)

@thomaseizinger thomaseizinger force-pushed the fix/snownet/replace-relay-if-credentials-differ branch from 4bc3909 to d187bbb Compare February 7, 2024 21:21
@thomaseizinger thomaseizinger added this pull request to the merge queue Feb 7, 2024
Merged via the queue into main with commit 4f4f374 Feb 7, 2024
49 checks passed
@thomaseizinger thomaseizinger deleted the fix/snownet/replace-relay-if-credentials-differ branch February 7, 2024 21:48
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.

None yet

2 participants