-
Notifications
You must be signed in to change notification settings - Fork 337
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
refactor(kademlia): add peers at start asynchronously #2082
Conversation
This may or may not improve anything. In my experience, the /topology Debug API also doesn't get an answer until the AddPeers call completes. So there seems to be some locking going on somewhere that may still prevent the Kademlia from making peer connection progress. Give it a try sometime. Start up a peer with a large (300,000+ population) address book and try to get :1635/topology. It will sit there for a long time (15-30 minutes for my nodes) until it responds. And as soon as it responds, the peer connections start happening. Other Debug APIs like /balances /addresses /settlements work perfectly fine during this delay. |
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.
Reviewed 3 of 3 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @anatollupacescu, @esadakar, and @mrekucci)
pkg/p2p/libp2p/libp2p.go, line 275 at r1 (raw file):
select { case <-s.ready: go func() { _ = stream.Reset() }()
you would need to return
after this, since this would just continue execution here
pkg/topology/kademlia/kademlia.go, line 585 at r1 (raw file):
addresses, err := k.addressBook.Overlays() if err != nil { panic(fmt.Errorf("addressbook overlays: %w", err))
I'm not sure that panicking is the right thing to do here, as it would cause a dirty shutdown. Logging the error and returning should be fine
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.
Reviewable status: 1 of 3 files reviewed, 2 unresolved discussions (waiting on @acud, @anatollupacescu, and @esadakar)
pkg/topology/kademlia/kademlia.go, line 585 at r1 (raw file):
Previously, acud (acud) wrote…
I'm not sure that panicking is the right thing to do here, as it would cause a dirty shutdown. Logging the error and returning should be fine
Done.
pkg/p2p/libp2p/libp2p.go, line 275 at r1 (raw file):
Previously, acud (acud) wrote…
you would need to
return
after this, since this would just continue execution here
Getting rid of this since the nodes cannot connect to each other even with the return
statement.
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.
Reviewed 3 of 3 files at r2.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @anatollupacescu and @esadakar)
This change is