-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[Feat] Limit peer pool size, remove banned peers from the pool #3905
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
Conversation
Signed-off-by: ljedrz <[email protected]>
Signed-off-by: ljedrz <[email protected]>
Signed-off-by: ljedrz <[email protected]>
Signed-off-by: ljedrz <[email protected]>
Signed-off-by: ljedrz <[email protected]>
…Router Signed-off-by: ljedrz <[email protected]>
Signed-off-by: ljedrz <[email protected]>
kaimast
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me. I left multiple small comments that we can hopefully address quickly.
Signed-off-by: ljedrz <[email protected]>
… accident Signed-off-by: ljedrz <[email protected]>
Signed-off-by: ljedrz <[email protected]>
|
All review comments have been addressed, and |
vicsn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, let's await Kai's review before merging
Signed-off-by: ljedrz <[email protected]>
|
It still appears to me that there are potential race conditions. Read-write dependencies exist in a few places (e.g., when truncating the peers to add based on the existing number of candidate peers), but not for all of them a lock is held the entirety of the critical section. If you think these race conditions are unlikely or the outcome is benign, e.g., a node might end up with some candidate peers too few/many, then I am okay with merging it. For the line where it inserts new candidate peers, I would still prefer if it (double) checks it will not overwrite an existing connected peer. Using |
Signed-off-by: ljedrz <[email protected]>
|
I've given it some thought, and decided to hold the write guard for the entire duration of |
This PR is larger than I expected, so I decided to also create an issue for the remaining bits.
The changes are as follows:
Router'sResolverwith the one from theGateway, using it for both entitiesGatewayand theRouter, moving all auxiliary cleanups to theDisconnecttrait which already handles thoseGatewayand theRouter, and makes it so that validator peer lists go through the peer pool before any connection attempts are made to them (in order for the heartbeat to fully control that process)Open points:
Gatewayand theRouterfiltereddevaddresses (!is_local_ipvs!is_bogon_ip); I left the latter for now, but this may need to be distinguished based onSelf::OWNERif we see any test/devnet issuesCloses #3872.
CC #3888.