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

v0.6.1 - Empty DHT routing table #561

Closed
hsanjuan opened this issue Apr 6, 2020 · 3 comments
Closed

v0.6.1 - Empty DHT routing table #561

hsanjuan opened this issue Apr 6, 2020 · 3 comments

Comments

@hsanjuan
Copy link
Contributor

hsanjuan commented Apr 6, 2020

Since v0.6.1 I have a few of my tests are failing because the DHT routing table is empty, therefore discovery does not work any more.

The host setup process is as follows:

  • N Hosts are created
  • 1 Additional host is created
  • This additional host does host.Connect(...) to each of the N hosts

The DHTs for each host are created before opening a connection.

Each of the N hosts is expected to be able to find routing to any of the others, with discovery happening via the DHT.

The routing table should have received 1 entry upon Connect and therefore auto-discovered everyone else on the first routing table refresh. However, this refresh is having no effect. Logs show how the refresh fails:

2020-04-07T00:59:25.105+0200    WARN    dht     go-libp2p-kad-dht@v0.6.1/dht_bootstrap.go:125   failed when refreshing routing table   {"error": "1 error occurred:\n\t* failed to do a random walk for cpl 0: failed to find any peer in table\n\n"}

This worked in v0.5.2. Any ideas on why there are no peers in the routing table when one peer has opened a connection?

@aschmahmann
Copy link
Contributor

@hsanjuan it's hard to say exactly what the problem is without looking at the test, can you post the link?

A diagnostic questions though: are you waiting for the DHTs to be connected to each other (e.g. periodically polling routing table sizes to see if > 1) or doing something racy like time.Sleep(time.Second)? If you're doing this in a racy way I'd recommend doing some polling like we do with

func waitForWellFormedTables(t *testing.T, dhts []*IpfsDHT, minPeers, avgPeers int, timeout time.Duration) bool {

This will inform us whether there's an issue wherein the routing table will never populate.

@Stebalien
Copy link
Member

Ah, wait... The DHT now defaults to starting in "auto" mode. A DHT node will only transition to server mode if it finds an AutoNAT server that tells it that it's dialable. That's probably your issue.

I've filed two related issues: #564, libp2p/go-libp2p-autonat#73.

(and I'm going to cut an RC without the mode switching for now)

@hsanjuan
Copy link
Contributor Author

hsanjuan commented Apr 7, 2020

Thanks, I'm closing this in favor of the other issues.

@hsanjuan hsanjuan closed this as completed Apr 7, 2020
@Stebalien Stebalien mentioned this issue Apr 21, 2020
7 tasks
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

No branches or pull requests

3 participants