-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix memory leak in TCP connection #765
Conversation
We remove `startTls` which was needed for Tor connection through Socks5 proxy. It is not needed anymore since we are switching to Orbot on phoenix.
This reverts commit d1413f4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Just one nit: the leak test could have been added to commonTest
and also used on linux ?
It could, but this test was just useful for investigating easily on the JVM. I verified on native by including this change in |
@dpad85 @robbiehanson please confirm this is okay |
It is OK, tested on Android & iOS. |
This version includes ACINQ/lightning-kmp#765 which should fix #118 and #136.
We instantiated a new
SelectorManager
at each connection attempt, leaking resources even if each socket was properly cleaned up on disconnection. The leak affects both jvm and native.The actual fix is in the commit use a static SelectorManager.
The reformat + cleanup commit is optional. In particular it removes the
startTls
function that is not used anymore since we moved Tor outside phoenix (ACINQ/phoenix#662).I've added a repro test and reverted it after the fix:
./gradlew jvmTest --tests "*LeakTests*"
watch -d "sudo lsof -p xxx | grep TCP"
Output before:
Output after: