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

p2p/discover: slow down lookups on empty table #20389

Merged
merged 2 commits into from
Nov 26, 2019

Conversation

fjl
Copy link
Contributor

@fjl fjl commented Nov 25, 2019

This is a hotfix for an issue where peer discovery would busy-wait in the lookup
iterator when the node is offline for a while.

@fjl fjl added this to the 1.9.8 milestone Nov 25, 2019
@fjl fjl requested a review from zsfelfoldi as a code owner November 25, 2019 14:39
// for the table to fill in this case, but there is no good mechanism for that
// yet.
if len(closest.entries) == 0 {
time.Sleep(1 * time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

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

After having sleeped for a whole second, wouldn't it make sense to check it.tab.closest once more before returning empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we're now using lookupIterator exclusively, it'll just come around and trigger another lookup right after one finishes without any result.

Copy link
Member

Choose a reason for hiding this comment

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

1 * time.Second -> time.Second?

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

Minor Q, otherwise LGTM

@karalabe
Copy link
Member

QQ: Won't this have maybe some adverse effect on hive? No idea, just asking.

@fjl
Copy link
Contributor Author

fjl commented Nov 25, 2019

I don't think there will be any effect on hive.

@karalabe
Copy link
Member

node tests are deadlocking with this PR

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.

3 participants