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

resolver/dns: exponential retry when getting empty address list #2201

Merged
merged 4 commits into from
Jul 13, 2018

Conversation

lyuxuan
Copy link
Contributor

@lyuxuan lyuxuan commented Jul 3, 2018

fix #1795

@@ -66,7 +67,7 @@ func NewBuilder() resolver.Builder {
}

type dnsBuilder struct {
// frequency of polling the DNS server.
// minimum frequency of polling the DNS server.
Copy link
Member

Choose a reason for hiding this comment

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

"Maximum"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think frequency is minimum, interval is maximum.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, you're right. The variable is not actually the frequency, it's the interval, hence my confusion.

I also think we should rename the variable to something to indicate it's a limit now, e.g. "maxDelay" or "minFreq".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to minFreq

d.retryCount++
d.t.Reset(d.backoff.Backoff(d.retryCount))
} else {
if d.retryCount != 0 {
Copy link
Member

Choose a reason for hiding this comment

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

The "if" here is unnecessary and is worse for performance (CPUs hate conditional branches far more than stores).

@lyuxuan lyuxuan merged commit ce6ee6b into grpc:master Jul 13, 2018
@menghanl menghanl added this to the 1.14 Release milestone Jul 20, 2018
@menghanl menghanl changed the title dns resolver: exponential retry when getting empty address list resolver/dns: exponential retry when getting empty address list Jul 25, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DNS Resolver can get stuck with no connections
3 participants