Closed gabrielmer closed 2 weeks ago
Good catch. Slightly related: https://github.com/waku-org/nwaku/issues/1737
At some point we considered disabling/removing keepAlive, but we ended up just disabling it. The feature its still there and used by eg waku-simulator. While it's not the root cause of this issue, removing it should fix the problem. At this point, I'm not sure it makes sense to have it.
cc @vpavlin Guess your network monitor will get crazy with this?
Not urgent as its handled by libp2p timeouts, but is a nice-to-have.
Background
A node pings its peers every 2 minutes in https://github.com/waku-org/nwaku/blob/56ff30ca75100b06cb5157ae2655092b3051ec8c/waku/node/waku_node.nim#L1072-L1073 However the connections are never closed
We rely on libp2p's default connection limits. For example
proc withMplex*(b: SwitchBuilder, inTimeout = 5.minutes, outTimeout = 5.minutes, maxChannCount = 200): SwitchBuilder
If that's not set by libp2p (what has happened us with yamux), the number of connections grows indefinitely. We should close unused connections ourselves.
Acceptance criteria
Unused connections are deliberately closed