Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Android - continual loading of map kills app #4224

Closed
snodnipper opened this issue Mar 7, 2016 · 9 comments
Closed

Android - continual loading of map kills app #4224

snodnipper opened this issue Mar 7, 2016 · 9 comments
Labels
Android Mapbox Maps SDK for Android crash

Comments

@snodnipper
Copy link

I have a demo app that styles the map according to the Android theme. When we press the layer button, we have to restart the activity to ensure that all the chrome (buttons etc.) is styled correctly.

After about 10 change style clicks we end up with the blow-up below. This may be related to #2995

This was captured from an HTC M8 but I will check other devices.

E/StrictMode( 3320): A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
E/StrictMode( 3320): java.lang.Throwable: Explicit termination method 'release' not called
E/StrictMode( 3320):    at dalvik.system.CloseGuard.open(CloseGuard.java:184)
E/StrictMode( 3320):    at android.view.Surface.setNativeObjectLocked(Surface.java:412)
E/StrictMode( 3320):    at android.view.Surface.<init>(Surface.java:140)
E/StrictMode( 3320):    at com.mapbox.mapboxsdk.maps.MapView$SurfaceTextureListener.onSurfaceTextureAvailable(MapView.java:1156)
E/StrictMode( 3320):    at android.view.TextureView.getHardwareLayer(TextureView.java:370)
E/StrictMode( 3320):    at android.view.View.updateDisplayListIfDirty(View.java:14110)
E/StrictMode( 3320):    at android.view.View.getDisplayList(View.java:14156)
E/StrictMode( 3320):    at android.view.View.draw(View.java:14923)
E/StrictMode( 3320):    at android.view.ViewGroup.drawChild(ViewGroup.java:3410)
E/StrictMode( 3320):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3204)
E/StrictMode( 3320):    at android.view.View.draw(View.java:15202)
E/StrictMode( 3320):    at android.widget.FrameLayout.draw(FrameLayout.java:592)
E/StrictMode( 3320):    at android.view.View.updateDisplayListIfDirty(View.java:14133)
E/StrictMode( 3320):    at android.view.View.getDisplayList(View.java:14156)
E/StrictMode( 3320):    at android.view.View.draw(View.java:14923)
E/StrictMode( 3320):    at android.view.ViewGroup.drawChild(ViewGroup.java:3410)
E/StrictMode( 3320):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3204)
E/StrictMode( 3320):    at android.view.View.updateDisplayListIfDirty(View.java:14128)
E/StrictMode( 3320):    at android.view.View.getDisplayList(View.java:14156)
E/StrictMode( 3320):    at android.view.View.draw(View.java:14923)
E/StrictMode( 3320):    at android.view.ViewGroup.drawChild(ViewGroup.java:3410)
E/StrictMode( 3320):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3204)
E/StrictMode( 3320):    at android.view.View.updateDisplayListIfDirty(View.java:14128)
E/StrictMode( 3320):    at android.view.View.getDisplayList(View.java:14156)
E/StrictMode( 3320):    at android.view.View.draw(View.java:14923)
E/StrictMode( 3320):    at android.view.ViewGroup.drawChild(ViewGroup.java:3410)
E/StrictMode( 3320):    at android.support.v4.widget.DrawerLayout.drawChild(DrawerLayout.java:1369)
E/StrictMode( 3320):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3204)
E/StrictMode( 3320):    at android.view.View.draw(View.java:15202)
E/StrictMode( 3320):    at android.view.View.updateDisplayListIfDirty(View.java:14133)
E/StrictMode( 3320):    at android.view.View.getDisplayList(View.java:14156)
E/StrictMode( 3320):    at android.view.View.draw(View.java:14923)
E/StrictMode( 3320):    at android.view.ViewGroup.drawChild(ViewGroup.java:3410)
E/StrictMode( 3320):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3204)
E/StrictMode( 3320):    at android.view.View.updateDisplayListIfDirty(View.java:14128)
E/StrictMode( 3320):    at android.view.View.getDisplayList(View.java:14156)
E/StrictMode( 3320):    at android.view.View.draw(View.java:14923)
E/StrictMode( 3320):    at android.view.ViewGroup.drawChild(ViewGroup.java:3410)
E/StrictMode( 3320):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3204)
E/StrictMode( 3320):    at android.view.View.updateDisplayListIfDirty(View.java:14128)
E/StrictMode( 3320):    at android.view.View.getDisplayList(View.java:14156)
E/StrictMode( 3320):    at android.view.View.draw(View.java:14923)
E/StrictMode( 3320):    at android.view.ViewGroup.drawChild(ViewGroup.java:3410)
E/StrictMode( 3320):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3204)
E/StrictMode( 3320):    at android.view.View.updateDisplayListIfDirty(View.java:14128)
E/StrictMode( 3320):    at android.view.View.getDisplayList(View.java:14156)
E/StrictMode( 3320):    at android.view.View.draw(View.java:14923)
E/StrictMode( 3320):    at android.view.ViewGroup.drawChild(ViewGroup.java:3410)
E/StrictMode( 3320):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3204)
E/StrictMode( 3320):    at android.view.View.updateDisplayListIfDirty(View.java:14128)
E/StrictMode( 3320):    at android.view.View.getDisplayList(View.java:14156)
E/StrictMode( 3320):    at android.view.View.draw(View.java:14923)
E/StrictMode( 3320):    at android.view.ViewGroup.drawChild(ViewGroup.java:3410)
E/StrictMode( 3320):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3204)
E/StrictMode( 3320):    at android.view.View.draw(View.java:15202)
E/StrictMode( 3320):    at android.widget.FrameLayout.draw(FrameLayout.java:592)
E/StrictMode( 3320):    at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2664)
E/StrictMode( 3320):    at android.view.View.updateDisplayListIfDirty(View.java:14133)
E/StrictMode( 3320):    at android.view.View.getDisplayList(View.java:14156)
E/StrictMode( 3320):    at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:299)
E/StrictMode( 3320):    at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:305)
E/StrictMode( 3320):    at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:344)
E/StrictMode( 3320):    at android.view.ViewRootImpl.draw(ViewRootImpl.java:2641)
E/StrictMode( 3320):    at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2464)
E/StrictMode( 3320):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2062)
E/StrictMode( 3320):    at android.view.ViewRo

Turning off StrictMode still results in a crash.

W/libc    ( 8847): Security Level: (1), Debug inforamtion is controlled by the DUMPABLE flag.
I/DEBUG   (  460): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (  460): Build fingerprint: 'htc/vodafone_uk/htc_m8:5.0.1/LRX22C/457188.2:user/release-keys'
I/DEBUG   (  460): Revision: '0'
I/DEBUG   (  460): ABI: 'arm'
I/DEBUG   (  460): pid: 8847, tid: 9139, name: Thread-3069  >>> uk.os.elements.demo <<<
I/DEBUG   (  460): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------

I/DEBUG   (  460):     r0 00000000  r1 000023b3  r2 00000006  r3 00000000
I/DEBUG   (  460):     r4 9d52add8  r5 00000006  r6 00000000  r7 0000010c
I/DEBUG   (  460):     r8 b9826300  r9 b976d770  sl fffff484  fp 9d52a868
I/DEBUG   (  460):     ip 000023b3  sp 9d52a808  lr b6eaf7bd  pc b6ed6240  cpsr 600e0010
I/DEBUG   (  460): 
I/DEBUG   (  460): backtrace:
I/DEBUG   (  460):     #00 pc 0003a240  /system/lib/libc.so (tgkill+12)
I/DEBUG   (  460):     #01 pc 000137b9  /system/lib/libc.so (pthread_kill+52)
I/DEBUG   (  460):     #02 pc 000143d7  /system/lib/libc.so (raise+10)
I/DEBUG   (  460):     #03 pc 00010cdd  /system/lib/libc.so (__libc_android_abort+36)
I/DEBUG   (  460):     #04 pc 0000f460  /system/lib/libc.so (abort+4)
I/DEBUG   (  460):     #05 pc 003f1d40  /data/app/uk.os.elements.demo-1/lib/arm/libmapbox-gl.so
I/DEBUG   (  460):     #06 pc 003f1e70  /data/app/uk.os.elements.demo-1/lib/arm/libmapbox-gl.so
I/DEBUG   (  460):     #07 pc 003e24c8  /data/app/uk.os.elements.demo-1/lib/arm/libmapbox-gl.so
I/DEBUG   (  460):     #08 pc 003e25b4  /data/app/uk.os.elements.demo-1/lib/arm/libmapbox-gl.so (std::terminate()+136)
I/DEBUG   (  460):     #09 pc 000e446c  /data/app/uk.os.elements.demo-1/lib/arm/libmapbox-gl.so
@tobrun tobrun added Android Mapbox Maps SDK for Android crash labels Mar 7, 2016
@tobrun tobrun added this to the android-v4.0.0 milestone Mar 7, 2016
@tobrun
Copy link
Member

tobrun commented Mar 7, 2016

This will not resolve the mentioned crash but why not leverage the power of the Theme.AppCompat.DayNight in the newest android support library. No hacks needed with restarting the Activity to change themes, you can just use the AppCompatDelegate. More information on this topic here.

@tobrun
Copy link
Member

tobrun commented Mar 7, 2016

Looking at the stacktrace show above, it's allmost the same as:

03-07 21:16:15.396 21751-25248/? A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 25248 (Thread-8162)
03-07 21:16:15.513 201-201/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
03-07 21:16:15.514 201-201/? A/DEBUG: Build fingerprint: 'google/hammerhead/hammerhead:6.0/MPA44I/2172151:user/release-keys'
03-07 21:16:15.514 201-201/? A/DEBUG: Revision: '0'
03-07 21:16:15.514 201-201/? A/DEBUG: ABI: 'arm'
03-07 21:16:15.515 201-201/? A/DEBUG: pid: 21751, tid: 25248, name: Thread-8162  >>> com.mapbox.mapboxsdk.testapp <<<
03-07 21:16:15.515 201-201/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
03-07 21:16:15.539 201-201/? A/DEBUG:     r0 00000000  r1 000062a0  r2 00000006  r3 9c4bf978
03-07 21:16:15.539 201-201/? A/DEBUG:     r4 9c4bf980  r5 9c4bf930  r6 00000000  r7 0000010c
03-07 21:16:15.540 201-201/? A/DEBUG:     r8 9ca54988  r9 9bbf76a0  sl fffff484  fp 9c4bf3c8
03-07 21:16:15.540 201-201/? A/DEBUG:     ip 00000006  sp 9c4bf368  lr b6cbbaf1  pc b6cbde54  cpsr 400d0010
03-07 21:16:15.559 201-201/? A/DEBUG: backtrace:
03-07 21:16:15.560 201-201/? A/DEBUG:     #00 pc 00041e54  /system/lib/libc.so (tgkill+12)
03-07 21:16:15.560 201-201/? A/DEBUG:     #01 pc 0003faed  /system/lib/libc.so (pthread_kill+32)
03-07 21:16:15.560 201-201/? A/DEBUG:     #02 pc 0001c30f  /system/lib/libc.so (raise+10)
03-07 21:16:15.560 201-201/? A/DEBUG:     #03 pc 000194c1  /system/lib/libc.so (__libc_android_abort+34)
03-07 21:16:15.560 201-201/? A/DEBUG:     #04 pc 000174ac  /system/lib/libc.so (abort+4)
03-07 21:16:15.560 201-201/? A/DEBUG:     #05 pc 003f1a60  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/arm/libmapbox-gl.so
03-07 21:16:15.560 201-201/? A/DEBUG:     #06 pc 003f1b90  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/arm/libmapbox-gl.so
03-07 21:16:15.560 201-201/? A/DEBUG:     #07 pc 003e21e8  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/arm/libmapbox-gl.so
03-07 21:16:15.560 201-201/? A/DEBUG:     #08 pc 003e22d4  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/arm/libmapbox-gl.so (std::terminate()+136)
03-07 21:16:15.560 201-201/? A/DEBUG:     #09 pc 000e44bc  /data/app/com.mapbox.mapboxsdk.testapp-2/lib/arm/libmapbox-gl.so

I can reproduce this fairly easy if I back press 2 stacked activities quickly.

@tobrun
Copy link
Member

tobrun commented Mar 7, 2016

I'm currently testing out the fix proposed in #2995 (comment)

@snodnipper
Copy link
Author

Thanks @tobrun for sorting that!

re day and night - totally agree, it would be awesome to automagically change the theme for day and night - certainly if it was my app.

Regardless, I'll try and dig through some of the appcompat code to see whether we could have several themes available to switch at runtime and use in combination with a layer switcher. We certainly have day and night map styles but also some maps are high contrast with pretty random colors - where we need to set a theme specific for the layer...others like satellite could do with a sample from the map to work out what looks good (e.g. desert vs rainforest).

@tobrun
Copy link
Member

tobrun commented Mar 8, 2016

@snodnipper
I'm currently setting up a test where you can click a FAB that executes the following:

finish();
startActivity(new Intent(MainActivity.this, MainActivity.class));

I'm currently not able to produce any crashes with current state of master.
We have resolved multiple crashes the last few days and I'm hoping that the issue is now resolved.
To be sure I will go back to an older commit and check if I can reproduce the crash.

@tobrun
Copy link
Member

tobrun commented Mar 8, 2016

@snodnipper
what version of the SDK are you using?
could you by any chance retest with the SNAPSHOT?
(note that the snapshot has major API changes)

@snodnipper
Copy link
Author

@tobrun I was executing at commit 0875a06

I'll pull the latest changes.

@snodnipper
Copy link
Author

That is looking pretty stable - I haven't crashed it yet in my emulator. We'll give it a go on some real devices but it appears solved to me. Really well done.

I'll take a look at the project tonight and pull out any work-arounds.

@tobrun
Copy link
Member

tobrun commented Mar 10, 2016

@snodnipper
thank you for retesting. Going to close this, reopen if you are able reproduce.
Thanks again for reaching out, these kind of reports enables us to make better and robuster SDK!

@tobrun tobrun closed this as completed Mar 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android crash
Projects
None yet
Development

No branches or pull requests

2 participants