MetaMask / metamask-android-sdk

MetaMask SDK for Android
Other
46 stars 14 forks source link

[Bug]: A connection to https://metamask-sdk-socket.metafi.codefi.network/ was leaked #71

Closed philos3 closed 9 months ago

philos3 commented 9 months ago

Provide environment information

error

MetaMask Android SDK Version

'io.metamask.androidsdk:metamask-android-sdk:0.3.0'

MetaMask Mobile app Version

v7.12.3(1230)

Android Version

android 13

Describe the Bug

W/okhttp.OkHttpClient(28328): A connection to https://metamask-sdk-socket.metafi.codefi.network/ was leaked. Did you forget to close a response body? W/okhttp.OkHttpClient(28328): java.lang.Throwable: response.body().close() W/okhttp.OkHttpClient(28328): at okhttp3.internal.platform.Platform.getStackTraceForCloseable(Platform.kt:145) W/okhttp.OkHttpClient(28328): at okhttp3.internal.connection.RealCall.callStart(RealCall.kt:170) W/okhttp.OkHttpClient(28328): at okhttp3.internal.connection.RealCall.enqueue(RealCall.kt:163) W/okhttp.OkHttpClient(28328): at io.metamask.androidsdk.HttpClient.newCall(HttpClient.kt:32) W/okhttp.OkHttpClient(28328): at io.metamask.androidsdk.Analytics.trackEvent(Analytics.kt:38) W/okhttp.OkHttpClient(28328): at io.metamask.androidsdk.CommunicationClient.trackEvent(CommunicationClient.kt:108) W/okhttp.OkHttpClient(28328): at io.metamask.androidsdk.Ethereum.connect(Ethereum.kt:94) W/okhttp.OkHttpClient(28328): at com.example.wallet.metamask.MetamaskApiImpl.connectMetamask(MetamaskApiImpl.java:73) W/okhttp.OkHttpClient(28328): at com.example.wallet.WalletLibMessageApi$WalletApi$-CC.lambda$setUp$2(WalletLibMessageApi.java:188) W/okhttp.OkHttpClient(28328): at com.example.wallet.WalletLibMessageApi$WalletApi$$ExternalSyntheticLambda1.onMessage(Unknown Source:2) W/okhttp.OkHttpClient(28328): at io.flutter.plugin.common.BasicMessageChannel$IncomingMessageHandler.onMessage(BasicMessageChannel.java:219) W/okhttp.OkHttpClient(28328): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295) W/okhttp.OkHttpClient(28328): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322) W/okhttp.OkHttpClient(28328): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12) W/okhttp.OkHttpClient(28328): at android.os.Handler.handleCallback(Handler.java:942) W/okhttp.OkHttpClient(28328): at android.os.Handler.dispatchMessage(Handler.java:99) W/okhttp.OkHttpClient(28328): at android.os.Looper.loopOnce(Looper.java:226) W/okhttp.OkHttpClient(28328): at android.os.Looper.loop(Looper.java:313) W/okhttp.OkHttpClient(28328): at android.app.ActivityThread.main(ActivityThread.java:8810) W/okhttp.OkHttpClient(28328): at java.lang.reflect.Method.invoke(Native Method) W/okhttp.OkHttpClient(28328): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604) W/okhttp.OkHttpClient(28328): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

Expected Behavior

no error

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

No response

To Reproduce

i am not sure how

philos3 commented 9 months ago
image

need response.body?.close()

elefantel commented 9 months ago

Hi @philos3 thanks for reporting this! Yes we should have closed that response body.

We have done so in this pull request. We will release a patch 0.3.1 in the next few days. https://github.com/MetaMask/metamask-android-sdk/pull/72