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

Fix infinite loop in discoverer #2020

Merged
merged 3 commits into from Jun 18, 2021

Conversation

roman-khimov
Copy link
Member

Problem

Noticed by @532910:

    1880ms 18.80% 43.00%    10000ms   100%  github.com/nspcc-dev/neo-go/pkg/network.(*DefaultDiscovery).run

Solution

Backport some fixes from master.

1) It duplicates registration in `version` message handler and no valid
   connection can work without version exchange.
2) On public networks we have seed nodes defined by names, so we register
   connections to them using these names, but then if connection is dropped we
   delist them by IP:PORT combinations which can lead to zero PeerCount() with
   all seeds still being registered as connected in the discovery subsystem
   and thus no reconnection attempts being made.
We can have multiple copies of the same address in the pool and we should only
proceed to connect once per attempt.
@roman-khimov roman-khimov added the bug Something isn't working label Jun 18, 2021
@roman-khimov roman-khimov added this to the v0.78.4 milestone Jun 18, 2021
It happens from time to time in a four-node private network where there are
seeds (aka CNs) and not a lot of other nodes to connect to.

I don't know how to test for an infinite loop that has no side-effects, so no
test added here.
@roman-khimov roman-khimov merged commit 0888dda into master-2.x Jun 18, 2021
@roman-khimov roman-khimov deleted the fix-infinite-loop-in-discoverer branch June 18, 2021 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants