Code Monkey home page Code Monkey logo

kademlia's People

Contributors

aleks-f avatar davidkeller avatar elkhishen avatar govi218 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

kademlia's Issues

Bootstrap connection hangs

Windows:
I can connect many peers to the bootstrap, no problem (tried 10 all worked). However, if I connect and disconnect the same peer I can only do it twice.( so the same ports..). The 3 rd time it does not properly connect it gets somehow locked when kademlia thread is started. After “killing” the peer (which hangs), no other connection is possible there is an exception thrown if you try to connect ANY peer on any ports. Restarting the bootstrap fixes the problem, and it is consistent (enough to use only one peer, connect to bootstrap, close it, start again, works second time, hangs the third time.

With Poco Kademlia, it happens always, you can connect and disconnect “same peer” (same ports) to bootstrap twice, the third time it fails (the peer practically hangs when it tries to open the session). Restarting the bootstrap will reset the counter but again you can do it twice .However, there is no problem connecting different peers (different ports) one after another, it’s the disconnect/reconnect on the same ports which creates the problem.

Linux:
Bootstrap connections don't seem to work at all on Ubuntu for one peer on a local network and work up to a few times on Windows (2 times before failing after, as Adrian mentioned). We can see that packets are being exchanged but they are not received appropriately by the peer. This has to do with the peer discovery process after initial connection with the bootstrap. We can work on getting these messages passed more efficiently (reducing the total number of packets sent for discovery/bootstrapping), but I wonder if this is an issue with the Proactor's polling mechanism.

For the hanging bug, just to recap, it happens using the “example” programs also, so nothing to do with our own software. Depending on what system you run you may be able to connect 2-3 times but also you may even fail the first time. I suppose if you run in a VM your chance to fail even the first time increases, may have to do with the system running slower, not the OS itself. I see in tests ( enabling logging for Engine and Session) that the initialization messages (hundreds) almost double after each disconnect/reconnect which may explain why even on “fast” systems (Windows runs on bare metal, not VM like we usually run Linux) it will happen after a few connections. In Linux (including WSL) fails the first time. Probably some time hazard when sending/receiving the initialization messages.

Fix slow save/load

I/O reported to be much slower than original kademlia; probably because of the I/O data buffer being dynamically allocated

Routing table storage

Routing table storage is implemented as a vector<list<pair<id, endpoint>>>. According to specification, the routing table should be a binary tree. Asked about the rationale in DavidKeller/kademlia#10.

Enable true async mode

Currently, the I/O has to be "serialized" from outside, which defeats the async nature of the I/O to a significant extent; while internally the I/O requests will be going on between multiple peers for every request, the request round-trip must be "outside shielded" (serialized) to prevent concurrent I/O requests.

There are two main reasons for this limitation:

  1. On startup, I/O may begin before Session was completely initialized; this has to do with SocketProactor::IOCompletion running in its own thread. Session constructor should wait for the initial discovery I/O to complete before proceeding and allowing kademlia library I/O operations to be issued.

  2. When I/O is running concurrently, loading values sometimes fails with "value not found" error; this manifest itself as a timeout, but increasing the timeout value does not help it - for some reason, some peers fail to respond with the sought for value; a "stopgap" that fixes this problem is to treat the timed out peers as new ("uncontacted") on such occurrence, but the true underlying reason for it should be further investigated (this problem does not happen when the loading operations are serialized)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.