libp2p / go-libp2p-kad-dht

A Kademlia DHT implementation on go-libp2p
https://github.com/libp2p/specs/tree/master/kad-dht
MIT License
516 stars 220 forks source link

add ctx canceled err check #960

Closed godeamon closed 7 months ago

godeamon commented 7 months ago

ISSUE: https://github.com/libp2p/go-libp2p-kad-dht/issues/958 There is no need to re-establish the connection for context canceled error, otherwise a lot of memory will be generated when calling GetValue in large numbers.

Looking forward to someone reviewing the code.

guillaumemichel commented 7 months ago

Thanks @godeamon for your contribution!

TestProvidesMany is failing consistently for Ubuntu and MacOS, note that this test is skipped in Windows following https://github.com/libp2p/go-libp2p-kad-dht/issues/760.

godeamon commented 7 months ago

@guillaumemichel Thanks for your reply. I've tested the new commit code locally without any issues. The previous code will cause memory leaks, please refer to the issue for details: https://github.com/libp2p/go-libp2p-kad-dht/issues/958

If this code can be merged, can a minor version be released? Otherwise, my program's memory will keep growing. Thank you very much!