QuintinZhangQQ / osmdroid

Automatically exported from code.google.com/p/osmdroid
0 stars 0 forks source link

OpenStreetMap Activity leaks ServiceConnection #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
View map

01-24 15:47:32.789: ERROR/ActivityThread(1706): Activity
org.andnav.osm.OpenStreetMap has leaked ServiceConnection
org.andnav.osm.views.util.OpenStreetMapTileProvider@44ca7818 that was
originally bound here
01-24 15:47:32.789: ERROR/ActivityThread(1706):
android.app.ServiceConnectionLeaked: Activity org.andnav.osm.OpenStreetMap
has leaked ServiceConnection
org.andnav.osm.views.util.OpenStreetMapTileProvider@44ca7818 that was
originally bound here
01-24 15:47:32.789: ERROR/ActivityThread(1706):     at
android.app.ActivityThread$PackageInfo$ServiceDispatcher.<init>(ActivityThread.j
ava:935)
01-24 15:47:32.789: ERROR/ActivityThread(1706):     at
android.app.ActivityThread$PackageInfo.getServiceDispatcher(ActivityThread.java:
830)
01-24 15:47:32.789: ERROR/ActivityThread(1706):     at
android.app.ApplicationContext.bindService(ApplicationContext.java:799)
01-24 15:47:32.789: ERROR/ActivityThread(1706):     at
android.content.ContextWrapper.bindService(ContextWrapper.java:337)
01-24 15:47:32.789: ERROR/ActivityThread(1706):     at
org.andnav.osm.views.util.OpenStreetMapTileProvider.<init>(OpenStreetMapTileProv
ider.java:57)
01-24 15:47:32.789: ERROR/ActivityThread(1706):     at
org.andnav.osm.views.overlay.OpenStreetMapTilesOverlay.<init>(OpenStreetMapTiles
Overlay.java:35)
01-24 15:47:32.789: ERROR/ActivityThread(1706):     at
org.andnav.osm.views.OpenStreetMapView.<init>(OpenStreetMapView.java:93)
01-24 15:47:32.789: ERROR/ActivityThread(1706):     at
org.andnav.osm.views.OpenStreetMapView.<init>(OpenStreetMapView.java:114)
01-24 15:47:32.789: ERROR/ActivityThread(1706):     at
org.andnav.osm.OpenStreetMap.onCreate(OpenStreetMap.java:60)
01-24 15:47:32.789: ERROR/ActivityThread(1706):     at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-24 15:47:32.789: ERROR/ActivityThread(1706):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
01-24 15:47:32.789: ERROR/ActivityThread(1706):     at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2470)
01-24 15:47:32.789: ERROR/ActivityThread(1706):     at
android.app.ActivityThread.access$2200(ActivityThread.java:119)
01-24 15:47:32.789: ERROR/ActivityThread(1706):     at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
01-24 15:47:32.789: ERROR/ActivityThread(1706):     at
android.os.Handler.dispatchMessage(Handler.java:99)
01-24 15:47:32.789: ERROR/ActivityThread(1706):     at
android.os.Looper.loop(Looper.java:123)
01-24 15:47:32.789: ERROR/ActivityThread(1706):     at
android.app.ActivityThread.main(ActivityThread.java:4310)
01-24 15:47:32.789: ERROR/ActivityThread(1706):     at
java.lang.reflect.Method.invokeNative(Native Method)
01-24 15:47:32.789: ERROR/ActivityThread(1706):     at
java.lang.reflect.Method.invoke(Method.java:521)
01-24 15:47:32.789: ERROR/ActivityThread(1706):     at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
01-24 15:47:32.789: ERROR/ActivityThread(1706):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
01-24 15:47:32.789: ERROR/ActivityThread(1706):     at
dalvik.system.NativeStart.main(Native Method)
01-24 15:47:32.797: WARN/ActivityManager(1170): Unbind failed: could not
find connection for android.os.BinderProxy@44fb30b8

Original issue reported on code.google.com by petersch...@googlemail.com on 24 Jan 2010 at 2:53

GoogleCodeExporter commented 9 years ago
This patch fixes the problem.

Disconnects the service when the OSM view is detached from window and 
automatically
reconnects on a new tile request.

Original comment by viesturz on 6 Apr 2010 at 12:10

Attachments:

GoogleCodeExporter commented 9 years ago
I have tried the patch but it still doesn't works. Now i get the following 
error:

I/ActivityManager(   52): Displayed activity com.myapp/.code.ViewRuns: 672 ms 
(total 672 ms)
E/OPENSTREETMAP(  211): Unbinding service
I/ActivityManager(   52): Stopping service: 
com.touristeye/.services.OpenStreetMapTileProviderService
I/ActivityManager(   52): Stopping service: 
com.touristeye/.services.OpenStreetMapTileProviderService
I/ActivityManager(   52): Stopping service: 
com.touristeye/.services.OpenStreetMapTileProviderService
I/ActivityManager(   52): Stopping service: 
com.touristeye/.services.OpenStreetMapTileProviderService
I/ActivityManager(   52): Stopping service: 
com.touristeye/.services.OpenStreetMapTileProviderService
D/OSM_TILE_PROVIDER_SERVICE(  211): onUnbind
I/ActivityManager(   52): Stopping service: 
com.touristeye/.services.OpenStreetMapTileProviderService
D/OSM_TILE_PROVIDER_SERVICE(  211): onDestroy
I/ActivityManager(   52): Stopping service: 
com.touristeye/.services.OpenStreetMapTileProviderService
I/ActivityManager(   52): Stopping service: 
com.touristeye/.services.OpenStreetMapTileProviderService
I/ActivityManager(   52): Stopping service: 
com.touristeye/.services.OpenStreetMapTileProviderService
I/ActivityManager(   52): Stopping service: 
com.touristeye/.services.OpenStreetMapTileProviderService
I/ActivityManager(   52): Stopping service: 
com.touristeye/.services.OpenStreetMapTileProviderService
I/ActivityManager(   52): Stopping service: 
com.touristeye/.services.OpenStreetMapTileProviderService
I/ActivityManager(   52): Stopping service: 
com.touristeye/.services.OpenStreetMapTileProviderService
W/ActivityManager(   52): Timeout executing service: ServiceRecord{43873640 
com.touristeye/.services.OpenStreetMapTileProviderService}
I/ActivityManager(   52): ANR in process: com.touristeye
I/ActivityManager(   52): Annotation: Executing service 
ComponentInfo{com.touristeye/com.touristeye.services.OpenStreetMapTileProviderSe
rvice}
I/ActivityManager(   52): CPU usage:
I/ActivityManager(   52): Load: 1.38 / 0.9 / 0.36
I/ActivityManager(   52): CPU usage from 23746ms to 33ms ago:
I/ActivityManager(   52):   com.touristeye: 9% = 8% user + 1% kernel / faults: 
682 minor

Thanks

Original comment by gefe...@gmail.com on 6 Apr 2010 at 1:47

GoogleCodeExporter commented 9 years ago
Sorry, my error, accidentally posted error message where debug should have been.

Fixed patch below.

Original comment by viesturz on 6 Apr 2010 at 3:08

Attachments:

GoogleCodeExporter commented 9 years ago
sorry but i still get the same problem

I/ActivityManager(   52): Stopping service: 
com.touristeye/.services.OpenStreetMapTileProviderService

and

W/ActivityManager(   52): Timeout executing service: ServiceRecord{43849000 
com.touristeye/.services.OpenStreetMapTileProviderService}

After that, the application seems to be not responding.

what can be the problem?

Original comment by gefe...@gmail.com on 6 Apr 2010 at 7:05

GoogleCodeExporter commented 9 years ago
Works fine for me in the demo app. This might be some problem in your app.
Care to share your source?

Original comment by viesturz on 7 Apr 2010 at 6:30

GoogleCodeExporter commented 9 years ago
In order to check if it is my problem i have tried the demo app (Sample 
Loader), loading maps from OSMapView 
with Itemized Overlay.

But the problem still remains when i go back from OSMApViewWithItemizedOverlay 
and i wait for (more or 
less) 20 seconds in the list that shows the different examples. After that 
time, the application seems to be not 
responding and logcat shows the following:

D/OPENSTREETMAP(  234): Unbinding service
D/OSM_TILE_PROVIDER_SERVICE(  243): onUnbind
D/OSM_TILE_PROVIDER_SERVICE(  243): onDestroy
W/ActivityManager(   56): Timeout executing service: ServiceRecord{43d75190 
org.andnav.osm/.services.OpenStreetMapTileProviderService}
I/ActivityManager(   56): ANR in process: org.andnav.osm:remote
I/ActivityManager(   56): Annotation: Executing service 
ComponentInfo{org.andnav.osm/org.andnav.osm.services.OpenStreetMapTileProviderSe
rvice}
I/ActivityManager(   56): CPU usage:
I/ActivityManager(   56): Load: 2.04 / 1.09 / 0.42
I/ActivityManager(   56): CPU usage from 20703ms to 37ms ago:
I/ActivityManager(   56):   dnav.osm:remote: 7% = 3% user + 4% kernel / faults: 
3293 minor
I/ActivityManager(   56):   system_server: 2% = 1% user + 1% kernel / faults: 
214 minor
I/ActivityManager(   56):   org.andnav.osm: 0% = 0% user + 0% kernel / faults: 
196 minor
I/ActivityManager(   56):   m.android.phone: 0% = 0% user + 0% kernel / faults: 
27 minor
I/ActivityManager(   56):   adbd: 0% = 0% user + 0% kernel
I/ActivityManager(   56):   putmethod.latin: 0% = 0% user + 0% kernel / faults: 
9 minor
I/ActivityManager(   56): TOTAL: 4% = 2% user + 1% kernel
I/ActivityManager(   56): Removing old ANR trace file from /data/anr/traces.txt
I/Process (   56): Sending signal. PID: 243 SIG: 3
I/dalvikvm(  243): threadid=7: reacting to signal 3
I/dalvikvm(  243): Wrote stack trace to '/data/anr/traces.txt'
I/Process (   56): Sending signal. PID: 56 SIG: 3
I/dalvikvm(   56): threadid=7: reacting to signal 3
I/dalvikvm(   56): Wrote stack trace to '/data/anr/traces.txt'
I/Process (   56): Sending signal. PID: 234 SIG: 3

Original comment by gefe...@gmail.com on 7 Apr 2010 at 9:55

GoogleCodeExporter commented 9 years ago
Thanks for the info, I will check this.

Original comment by viesturz on 7 Apr 2010 at 3:38

GoogleCodeExporter commented 9 years ago
thanks. when you finish to check it, can you notice me the results in order to 
check if i have the right code?

Original comment by gefe...@gmail.com on 7 Apr 2010 at 6:57

GoogleCodeExporter commented 9 years ago
Reproduced the issue.

The problem is that the service fails to stop properly, because it is waiting 
for the
remaining images to be downloaded. Probably related to the cloudmade tiles not 
being
available.

Will try to fix this.

Original comment by viesturz on 8 Apr 2010 at 7:06

GoogleCodeExporter commented 9 years ago
Fixed the problem.

Unfortunately it becomes difficult to separate this patch form #35. So this 
patch
contains both changes.

Let me know if you really want them separated.

Original comment by viesturz on 8 Apr 2010 at 7:24

Attachments:

GoogleCodeExporter commented 9 years ago
great! it works!

Original comment by gefe...@gmail.com on 8 Apr 2010 at 8:51

GoogleCodeExporter commented 9 years ago
How about integrating this in the source?

Original comment by viesturz on 12 Apr 2010 at 7:30

GoogleCodeExporter commented 9 years ago
New, smaller patch against rev #133.

Original comment by viesturz on 15 Apr 2010 at 10:19

Attachments:

GoogleCodeExporter commented 9 years ago
Better patch, only differences here.

Original comment by viesturz on 15 Apr 2010 at 10:33

Attachments:

GoogleCodeExporter commented 9 years ago
what is the difference between patch2 and patch3? thanks

Original comment by gefe...@gmail.com on 15 Apr 2010 at 2:46

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r136.

Original comment by neilboyd on 15 Apr 2010 at 7:52