Kad DHT stream reset

I have two peers connected with webrtc star transport and Kad dht.

modules: {
transport: [WebRTCStar],
connEncryption: [NOISE],
dht: KadDHT,
streamMuxer: [Mplex],
peerDiscovery: [],
peerRouting: [KadDHT]

When I use peer A to call dht.get(cid), I have Error:Not Found, which is normal.
But then I use peer B to call dht._putLocal(cid, data).
And use peer A to call dht.get(cid), I have this error:

Uncaught (in promise) Error: stream reset
at Object.reset (stream.js:72)
at Mplex._handleIncoming (mplex.js:227)
at mplex.js:156
at async Mplex.sink (mplex.js:149)

How should I resolve this problem?

Hello @th-781
Not exactly sure about the problem. Can you replicate this running with the debugger mode enabled and provide us the logs? Debug info
Moreover, you should not add the KadDHT to the peerRouting modules. I know this is confusing as KadDHT provides a peerRouting module. We want to improve the config to become more consistent, but for now the DHT need to be configured as a separate piece (and in the code we join it to the Peer and Content Routing modules.

This is the log showing Error: Not Found, which is not a problem.

This is the log showing Error: strean reset.

I will remove KadDHT from peerRouting for the time being. By the way, is it fine that I don’t use anything for peerDiscover? My intention is to let peers contact a local WebRTC Star signaling server, and use it to discovery peers.

Thanks for the logs. This is a bug somewhere in the DHT as the error is not being caught on the query. Can you please create an issue in GitHub - libp2p/js-libp2p-kad-dht: JavaScript implementation of the DHT for libp2p so that we track it and check what is going on with this? (add the logs there too)

Yes, a discovery module is not mandatory. Also in reality the webrtc-star transport is also a discovery module, but it is not transparent to the user. There are some gaps in the libp2p config that we need to improve to make these sort of things more clear to the users. We have this issue to discuss that work. If you would like to add there the pain points you are having with the libp2p config, I would be appreciate as this might help us prioritize this.