You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
libp2p is a peer to peer networking library used in IPFS among other things. We are using webrtc in go-libp2p to provide connectivity to nodes running in the browser. For our use, we create a peer connection and open lots of data channels over the life time of the connection.
Currently the reference to datachannels is not dropped when a datachannel is closed. PeerConnection.sctpTransport.dataChannels always has a reference to the existing data channels which has a reference to the sctp stream. Over the life time of the connection this leads to a lot of memory usage.
What did you expect?
I expected the memory used by the datachannel to be garbage collected.
Proposed fix
Datachannel has an OnClose handler. This handler should remove the datachannel from the sctpTransport
To preserve existing behaviour we should:
Only keep the reference to the ID that was used on the datachannel
Create a DataChannelStats object for the stats on the datachannel to preserve collectStats behaviour.
The text was updated successfully, but these errors were encountered:
Your environment.
What did you do?
libp2p is a peer to peer networking library used in IPFS among other things. We are using webrtc in go-libp2p to provide connectivity to nodes running in the browser. For our use, we create a peer connection and open lots of data channels over the life time of the connection.
Currently the reference to datachannels is not dropped when a datachannel is closed.
PeerConnection.sctpTransport.dataChannels
always has a reference to the existing data channels which has a reference to the sctp stream. Over the life time of the connection this leads to a lot of memory usage.What did you expect?
I expected the memory used by the datachannel to be garbage collected.
Proposed fix
Datachannel
has an OnClose handler. This handler should remove the datachannel from the sctpTransportTo preserve existing behaviour we should:
DataChannelStats
object for the stats on the datachannel to preserve collectStats behaviour.The text was updated successfully, but these errors were encountered: