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

DHT routing example code does not discover peers and exits irregularly #126

Closed
pvh opened this issue Oct 19, 2017 · 4 comments
Closed

DHT routing example code does not discover peers and exits irregularly #126

pvh opened this issue Oct 19, 2017 · 4 comments

Comments

@pvh
Copy link

pvh commented Oct 19, 2017

  • Version: 2a81fc7
  • Platform: ubuntu 17.10 / node v8.7.0
  • Subsystem: js-libp2p-dht-kad

Type: Example routing code crashes

Severity: high

Description: the example code does not execute successfully

Steps to reproduce the error:

  1. checkout js-libp2p
  2. copy examples/peer-and-content-routing/{12}.js somewhere
  3. npm install all the things
  4. node {1,2}.js

Result

The scripts fail to discover other peers and exit irregularly.

This is the DEBUG=* from routing/1.js: https://gist.github.com/anonymous/fc0b56120e94b054d0006f35fe8a5620

@dryajov
Copy link
Member

dryajov commented Oct 19, 2017

thanks for reporting this, @pvh !

@nunofmn
Copy link
Contributor

nunofmn commented Oct 20, 2017

It seems that 100 ms is not enough time to peers establish connections.
By increasing to 300 ms was possible to discover other peers

// Set up of the cons might take time
(cb) => setTimeout(cb, 100)

I'm going to open a PR to increase the delay.

@pvh
Copy link
Author

pvh commented Oct 20, 2017

On a different machine here the examples work with a 100ms timeout but not a 10ms timeout, so it appears you've found the right cause, Nuno. I would suggest a more descriptive error message is worth doing. Also, if you're fixing the examples the link from the README.md is broken.

@daviddias
Copy link
Member

Thanks for fixing this @nunofmn and @pvh for catching :)

@ghost ghost removed the status/ready Ready to be worked label Feb 5, 2018
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

4 participants