isaaczafuta / pydht

Python implementation of the Kademlia DHT data store
https://isaac.zafuta.com/pydht
Other
63 stars 33 forks source link

Successive key retrieval error on 2 node DHT #3

Open robertsdotpm opened 9 years ago

robertsdotpm commented 9 years ago

After storing the key in the DHT (a two node DHT with one the bootstrap node), retrieving the key randomly raises KeyError. For example, if you store a key and then run a program like 5 - 20 times to retrieve that same key it will randomly fail. Why would that be? Is the DHT not 100% reliable / not redistributing keys?

(I'm not an expert on DHTs so maybe this is normal but worth checking out.)

robertsdotpm commented 9 years ago

For anyone interested: It seems that information storage on this DHT has little spam prevention. For example, it stores a separate peer entry for every node (even if it has the same host and port.) There's also no possible timeout on message storage - maybe you want to add a timeout to prevent abuse or you don't want to store information forever.

I guess I'm going to have to add these as its unnecessary to have multiple entries for the same host. Some basic defences against Sybil attacks would also be needed for production use. The software should probably also avoid adding node entries if it has the same host and port.) Currently the ID check doesn't work that well since its random between every new invocation. )