What causes a "stream reset"?

What will cause a stream reset when trying to read from a stream? Is it if the other side closes/reopens the stream?

Currently using go-libp2p and getting this error every so often, wondering what would cause it.

1 Like

I would also like to know the answer to this question. I have been observing lot of stream reset as well and not sure what causes it? Should the sender simply retry when a stream reset happens?

A stream reset is an abrupt interruption of the stream. It usually indicates some unexpected state, or internal error on some side. Do you see these stream resets on a particular protocol? If so, you should debug that protocol.

Also, which libp2p version are you using? And what implementations?

@noot @vishal just wanted to check if you still needed help here.

Nope. I figured it out.
Because the discovery mechanism didn’t allow for removal of specific peers on demand, I added my own PeerManager which would prune connections on-demand.
However, this meant that the pruning would sometimes kick-in when nodes are about to establish streams and I would then see these stream resets.
thanks for following up @raul ! appreciate all the responses.

Hello, I’m curious how you achieved the PeerManager, do you mind to share your code or something? Thanks

Sure - flow-go/peerManager.go at master · onflow/flow-go · GitHub