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

connect: use exp backoff when waiting on consul envoy bootstrap #10453

Merged
merged 1 commit into from
Apr 27, 2021

Conversation

shoenig
Copy link
Member

@shoenig shoenig commented Apr 26, 2021

This PR wraps the use of the consul envoy bootstrap command in
an expoenential backoff closure, configured to timeout after 60
seconds. This is an increase over the current behavior of making
3 attempts over 6 seconds.

Should help with #10451

@@ -0,0 +1,142 @@
// Package exptime provides a generalized exponential backoff retry implementation.
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 implement "exponential back-off" in a few places, but none of them generic and feature-full. It'd be nice to converge on a single implementation.

@shoenig
Copy link
Member Author

shoenig commented Apr 26, 2021

I'm wondering if we should backport this

Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

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

LGTM once we get the license in there. The library seems like the right one to use; they're accounting properly for the time it takes to perform the callback, which I've seen get missed a lot.

I'll leave it up to your judgement as to whether we want to classify this as a bugfix or an improvement in the changelog. If it's a bugfix, we should backport it.


// A Sleeper is a useful way for calling time.Sleep
// in a mock-able way for tests.
type Sleeper func(time.Duration)
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this alias is the only diff between oss.indeed.com/go/libtime/decay and this source file? While I understand and agree with not wanting to pull in the whole darn libtime library for this, the "derived work" being created here is an awfully minimal change. So for licensing safety, I think we're going to need to include the upstream license file in this package.

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 added the license

But yeah, the only reason I don't want to pull it in as a module is the transitive dependency on github.com/gojuno/minimock/v3 is several orders of magnitude larger than this one function we actually want

// account for how long we intended to sleep
consumed += duration

// exponentially increase the gap
Copy link
Member

Choose a reason for hiding this comment

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

This is fine because we should avoid creating more of a diff here, but "Dear libtime library authors, 2x per iteration is geometric backoff, not exponential." 😀

This PR wraps the use of the consul envoy bootstrap command in
an expoenential backoff closure, configured to timeout after 60
seconds. This is an increase over the current behavior of making
3 attempts over 6 seconds.

Should help with #10451
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

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

LGTM!

@shoenig shoenig merged commit 3dd7dff into main Apr 27, 2021
@shoenig shoenig deleted the b-envoy-wait-longer branch April 27, 2021 20:39
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 24, 2022
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.

None yet

2 participants