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

Add blacklisted peers in peermanager to avoid reconnection storm #171

Closed
wants to merge 4 commits into from

Conversation

philipsu522
Copy link
Contributor

Describe your changes and provide context

We hit scenarios where disconnected peers keep getting reconnected
image

Testing performed to validate your change

@@ -837,6 +861,7 @@ func (m *PeerManager) Disconnected(ctx context.Context, peerID types.NodeID) {
})
}

m.blacklisted[peerID] = time.Now()
Copy link
Contributor

Choose a reason for hiding this comment

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

One concern of adding peer to blacklist directly is that this might just be a good peer which happen to be restarted or something. What we can do here is to keep a disconnect frequency for each peer, and only blacklist if a peer constantly disconnected in the recent time window

@yzang2019
Copy link
Contributor

yzang2019 commented Dec 21, 2023

I'd also recommend switching to use https://github.com/hashicorp/golang-lru, this library makes expiration much easier to manage

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.

2 participants