[Issue] Mixnodes and gateway do not close connections properly #3187
Labels
bug
Something isn't working
bug-needs-triage
A bug that needs discussing and triage
nym-binaries
qa
Quality Assurance
Milestone
Describe the issue
When the upstream node closes its connection to a node, the connection is not closed properly by it, and leaves an open file in the system. This eventually leads to refusing new connections and makes the node unusable. (
nym/mixnode/src/node/listener/mod.rs
Line 47 in 639deeb
This issue was observed both on a gateway, and on a mixnode from first layer.
Expected behaviour
Nodes should cleanly remove connections once they're closed.
Steps to Reproduce
In a loop, start and stop a gateway-client pair. Mixnodes from the first layer will eventually show a lot of open file upon running
lsof | grep nym
Ex :
Which area of Nym were you using?
Private testnet of 3*2 mix nodes, one gateway, one socks5-proxy and one network-requester, running on v1.1.12. (Github tag
nym-binaries-v1.1.12
)Bug location
I believe this bug is caused by these two lines, not handling the case where the stream is closed and returns
None
.nym/mixnode/src/node/listener/connection_handler/mod.rs
Line 88 in 639deeb
nym/gateway/src/node/mixnet_handling/receiver/connection_handler.rs
Line 192 in 639deeb
Proposed fix
Here's a proposed bug fix, handling cases where the TCP stream of sphinx packets returns
None
, signalling the connection has been closed. This fix was briefly tested on the private testnet, correctly closing the leaking open file. It might not be exhaustive, some other places might need care as well.This diff file was created on top of tag
nym-binaries-v1.1.12
bugfix.txt
The text was updated successfully, but these errors were encountered: