Skip to content

fix: Improve tailnet connections by reducing timeouts #5043

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

Merged
merged 2 commits into from
Nov 13, 2022
Merged

Conversation

kylecarbs
Copy link
Member

This awaits connection ping before running a dial. Before, we were hitting the TCP retransmission and handshake timeouts, which could intermittently add 1 or 5 seconds to a connection being initialized.

This awaits connection ping before running a dial. Before,
we were hitting the TCP retransmission and handshake timeouts,
which could intermittently add 1 or 5 seconds to a connection
being initialized.
@kylecarbs kylecarbs requested a review from coadler November 13, 2022 02:56
@kylecarbs kylecarbs self-assigned this Nov 13, 2022
@kylecarbs kylecarbs merged commit 82f494c into main Nov 13, 2022
@kylecarbs kylecarbs deleted the tailfix branch November 13, 2022 17:33
@github-actions github-actions bot locked and limited conversation to collaborators Nov 13, 2022
defer ticker.Stop()
completedCtx, completed := context.WithCancel(ctx)
run := func() {
ctx, cancelFunc := context.WithTimeout(completedCtx, time.Second)
Copy link
Member

Choose a reason for hiding this comment

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

@kylecarbs Couldn't this timeout result in no ping ever completing if RTT is >1s?

Also wondering if there's a potential edge-case race in completedCtx being based on ctx. Let's say caller does cancel on their context, and ultimately in the select below completedCtx.Done() is selected to resolve before ctx.Done().

Copy link
Member Author

Choose a reason for hiding this comment

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

@mafredri you are certainly correct. I won't have time to tackle this today, but I'd appreciate if you went through this code and cleaned up any races you might encounter. You have a much better eye for these problems than I!

Copy link
Member

Choose a reason for hiding this comment

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

Sure 👍🏻

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

Successfully merging this pull request may close these issues.

2 participants