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

WIP: fixing getclosestpeers full-peerset bug #52

Merged
merged 3 commits into from Mar 6, 2017

Conversation

whyrusleeping
Copy link
Contributor

So far i've reproduced the issue in a test. The problem is that the 'limited size peerset' is incorrect. It gets filled up with peers from our routing table. Which also brings up the fact that we shouldnt be returning peers from our routing table immediately, they arent super likely to always be the closest peers to our query.

@whyrusleeping
Copy link
Contributor Author

Aside from the limited size peerset not being quite right, the main issue here is that we're pulling K peers from the routing table, not alpha (as specified by the paper)

@@ -312,19 +312,18 @@ func (dht *IpfsDHT) betterPeersToQuery(pmes *pb.Message, p peer.ID, count int) [

// no node? nil
if closer == nil {
log.Warning("no closer peers to send:", p)
Copy link
Member

Choose a reason for hiding this comment

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

Sure it should be warning? Won't this condition be end of every search?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this can only happen if the routing table is empty, and i think having an empty routing table while trying to respond to a peer who definitely has you in their routing table might be worthy of a warning log

dht.go Outdated
var filtered []peer.ID
for _, clp := range closer {

// == to self? thats bad
if p == dht.self {
Copy link
Member

Choose a reason for hiding this comment

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

p is a argument in this case, are you sure about that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

heh, no.

@Kubuxu Kubuxu requested review from Kubuxu and removed request for Kubuxu March 5, 2017 10:12
@whyrusleeping
Copy link
Contributor Author

CI is failed because i need to update go-libp2p-peer


// == to self? thats bad
if clp == dht.self {
log.Warning("attempted to return self! this shouldn't happen...")
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't that happen if we are in the closest 20 (?) peers, or is it filtered out too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its filtered out, we shouldnt actually ever hit this.

@Kubuxu
Copy link
Member

Kubuxu commented Mar 5, 2017

Apart from test failure.

@whyrusleeping whyrusleeping force-pushed the fix/closest-peers-issue branch 3 times, most recently from 922d029 to c05335f Compare March 6, 2017 05:16
First, we use Alpha instead of K as the number of peers we grab from the
routing table (as per the kademlia paper).

Second, we don't use a size limited set for the 'GetClosestPeers' query.
We're going to process more than K peers before we find the K closest
peers.

Third, Change GetClosestPeers to actually return the K Closest peers,
not a hodge podge of peers that it found on the way to finding the
closest peers.
@whyrusleeping whyrusleeping merged commit 8604818 into master Mar 6, 2017
@whyrusleeping whyrusleeping deleted the fix/closest-peers-issue branch March 6, 2017 06:00
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.

None yet

2 participants