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

Open
opened 2025-04-21 14:44:55 -04:00 by idk · 7 comments
Owner

Opened 2 years ago

Last modified 19 months ago

#2406newdefect

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

Reported by:MeehOwned 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

Opened [2 years ago](/timeline?from=2019-01-24T18%3A50%3A30Z&precision=second "See timeline at Jan 24, 2019 6:50:30 PM") Last modified [19 months ago](/timeline?from=2019-10-11T17%3A45%3A54Z&precision=second "See timeline at Oct 11, 2019 5:45:54 PM") ## [\#2406](/ticket/2406)[new](/query?status=new)[defect](/query?status=!closed&type=defect) # Android - net.i2p.android.I2PActivity has leaked ServiceConnection net.i2p.android.I2PActivityBase Reported by:[Meeh](/query?status=!closed&reporter=meeh)Owned by:[Meeh](/query?status=!closed&owner=meeh) Priority: [minor](/query?status=!closed&priority=minor) Milestone: [undecided](/milestone/undecided "No date set") Component: [apps/android](/query?status=!closed&component=apps%2Fandroid) Version: [0.9.38](/query?status=!closed&version=0.9.38) Keywords: Cc: [idk](/query?status=!closed&cc=~eyedeekay) Parent Tickets: Sensitive: [no](/query?status=!closed&sensitive=0) ### Description [(last modified by Meeh)](/ticket/2406?action=diff&version=3 "2019-06-18 19:06:24.651559+00:00") ``` 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
idk added this to the undecided milestone 2025-04-21 14:44:55 -04:00
idk added the
#2406
apps.android
undecided
labels 2025-04-21 14:44:55 -04:00
Author
Owner

This is no longer visible in GPlay reports and I can't reproduce it on any device.

This is no longer visible in GPlay reports and I can't reproduce it on any device.
Author
Owner

comment:6 Changed 19 months ago by zzz

Cc:idk added

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

[comment:6](https://trac.i2p2.de/\#comment:6) Changed [19 months ago](https://trac.i2p2.de//timeline?from=2019-10-11T17%3A45%3A54Z&precision=second "See timeline at Oct 11, 2019 5:45:54 PM") by zzz Cc:_idk_ added @meeh please check if this is still happening in 41 or higher
Author
Owner

comment:5 Changed 23 months ago by zzz

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

[comment:5](https://trac.i2p2.de/\#comment:5) Changed [23 months ago](https://trac.i2p2.de//timeline?from=2019-06-20T12%3A52%3A54Z&precision=second "See timeline at Jun 20, 2019 12:52:54 PM") by zzz Probably not related, but fixed 2nd possible leak in AppCache? (WebView?) in fc6bbc84dd68a337dfdae6a4258513a1c25b23e4 to be 0.9.41
Author
Owner

comment:4 Changed 23 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:4](https://trac.i2p2.de/\#comment:4) Changed [23 months ago](https://trac.i2p2.de//timeline?from=2019-06-19T15%3A29%3A29Z&precision=second "See timeline at Jun 19, 2019 3:29:29 PM") 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.
Author
Owner

comment:3 Changed 23 months ago by Meeh

Description:
modified ( diff)
Sensitive:
unset

[comment:3](https://trac.i2p2.de/\#comment:3) Changed [23 months ago](https://trac.i2p2.de//timeline?from=2019-06-18T19%3A06%3A24Z&precision=second "See timeline at Jun 18, 2019 7:06:24 PM") by Meeh Description: modified ( [diff](https://trac.i2p2.de//ticket/2406?action=diff&version=3)) Sensitive: unset
Author
Owner

comment:2 Changed 2 years 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:2](https://trac.i2p2.de/\#comment:2) Changed [2 years ago](https://trac.i2p2.de//timeline?from=2019-04-30T13%3A13%3A33Z&precision=second "See timeline at Apr 30, 2019 1:13:33 PM") 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](https://trac.i2p2.de/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](https://trac.i2p2.de/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()
Author
Owner

comment:1 Changed 2 years ago by zzz

Component:unspecified →
apps/androidOwner:
set to Meeh

[comment:1](https://trac.i2p2.de/\#comment:1) Changed [2 years ago](https://trac.i2p2.de//timeline?from=2019-01-24T22%3A47%3A44Z&precision=second "See timeline at Jan 24, 2019 10:47:44 PM") by zzz Component:unspecified → apps/androidOwner: set to _Meeh_
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: I2P_Developers/i2p.android.base#34
No description provided.