libp2p / go-libp2p-kad-dht

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

Improve tracing #873

Closed Jorropo closed 1 year ago

Jorropo commented 1 year ago

This reuse https://github.com/libp2p/go-libp2p-routing-helpers/pull/80 which logs all inputs and outputs

dennis-tra commented 1 year ago

If the channel was unbuffered that would leak go routines. However, the channel is buffered with alpha slots and we only spawn alpha queries.

Jorropo commented 1 year ago

If the channel was unbuffered that would leak go routines. However, the channel is buffered with alpha slots and we only spawn alpha queries.

Indeed I just got lucky and tests were passing at a moment, the actual issue was that Kubo were registering routing events and then synchronously call findprovs, however findprovs might not return until we first find something in the parallel routing helpers, so kubo was not draining the routing events and thus it was blocking the dht's logic. I moved the call to FindProvidersAsync in the goroutine Kubo were already using and now it's good.

guillaumemichel commented 1 year ago

LGTM, but let's wait for https://github.com/libp2p/go-libp2p-routing-helpers/pull/80 to land before we merge this PR.