Opened 9 months ago

Last modified 5 days ago

#2406 new defect

Android - net.i2p.android.I2PActivity has leaked ServiceConnection net.i2p.android.I2PActivityBase

Reported by: Meeh Owned by: Meeh
Priority: minor Milestone: undecided
Component: apps/android Version: 0.9.38
Keywords: Cc: idk
Parent Tickets: Sensitive: no

Description (last modified by Meeh)

2019-01-24 19:45:09.365 11901-11901/net.i2p.android.donate.debug E/ActivityThread: Activity net.i2p.android.I2PActivity has leaked ServiceConnection net.i2p.android.I2PActivityBase$RouterConnection@d2661d7 that was originally bound here
    android.app.ServiceConnectionLeaked: Activity net.i2p.android.I2PActivity has leaked ServiceConnection net.i2p.android.I2PActivityBase$RouterConnection@d2661d7 that was originally bound here
        at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:1336)
        at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:1231)
        at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1450)
        at android.app.ContextImpl.bindService(ContextImpl.java:1422)
        at android.content.ContextWrapper.bindService(ContextWrapper.java:636)
        at net.i2p.android.I2PActivityBase.bindRouter(I2PActivityBase.java:157)
        at net.i2p.android.I2PActivityBase.onStart(I2PActivityBase.java:59)
        at net.i2p.android.I2PActivity.onStart(I2PActivity.java:179)
        at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1248)
        at android.app.Activity.performStart(Activity.java:6696)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2612)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2710)
        at android.app.ActivityThread.-wrap12(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1461)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6088)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

Subtickets

Change History (6)

comment:1 Changed 9 months ago by zzz

Component: unspecifiedapps/android
Owner: set to Meeh

comment:2 Changed 6 months ago by zzz

So if auto-start is off, in I2PActivityBase, we only call bindRouter(), not startRouter().

See top answer at https://stackoverflow.com/questions/1992676/activity-app-name-has-leaked-serviceconnection-serviceconnection-name438030

reported stack trace is where it was 'originally bound' so that doesn't help us catch where the "leaked" exception is thrown.

This SO is probably more appropriate, it says if we bind then we have to unbind, which we do in onStop().

https://stackoverflow.com/questions/31296480/service-has-leaked-serviceconnection-that-was-originally-bound-here

So are there any cases where we don't call unbindService()? According to life cycle diagram, everything goes through onStop()

comment:3 Changed 4 months ago by Meeh

Description: modified (diff)
Sensitive: unset

comment:4 Changed 4 months ago by zzz

It's possible that this was leaking through the NewsFetcher? static ref, fixed in 6f181c44ff5071894c19222047b2e90ad3ab4af5 0.9.41.
Leaving ticket open to monitor.

comment:5 Changed 4 months ago by zzz

Probably not related, but fixed 2nd possible leak in AppCache? (WebView?) in fc6bbc84dd68a337dfdae6a4258513a1c25b23e4 to be 0.9.41

comment:6 Changed 5 days ago by zzz

Cc: idk added

@meeh please check if this is still happening in 41 or higher

Note: See TracTickets for help on using tickets.