libp2p / cpp-libp2p

C++17 implementation of libp2p
Apache License 2.0
347 stars 98 forks source link

Hotfix TCP socket leakage #188

Closed Harrm closed 1 year ago

Harrm commented 1 year ago

TCP Connections are stored in shared ptrs and are leaking somewhere, so that when some errors happens while establishing a connection we might end up in a situation when we don't hold any references to the connection in the client code, but the socket for this connection is still open. This can easily lead to open sockets piling up to the point where the process is killed due to running out of file descriptors. This patch closes the socket on error, however the TcpConnection objects will still remain in memory, which will have to be fixed with more based refactoring.