nativescript-mapbox: Android Crashes on App Resume

  • Install plugin into demo app using demo code.
  • Run the app
  • Pause (minimize the app)
  • Resume and šŸ’„

Won’t see the NS exception activity since its a crash.

Android Studio logs provide this:

    --------- beginning of crash
2018-10-16 10:57:05.165 7650-7891/com.permobil.smarteval A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x58 in tid 7891 (GLThread 8661), pid 7650 (mobil.smarteval)
2018-10-16 10:57:05.187 610-610/? E/HWComposer: getLayerReleaseFence failed for display -1: Invalid display
2018-10-16 10:57:05.204 610-610/? E/HWComposer: getLayerReleaseFence failed for display -1: Invalid display
2018-10-16 10:57:05.237 610-610/? E/HWComposer: getLayerReleaseFence failed for display -1: Invalid display
2018-10-16 10:57:05.255 610-610/? E/HWComposer: getLayerReleaseFence failed for display -1: Invalid display
2018-10-16 10:57:05.268 7894-7894/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2018-10-16 10:57:05.268 7894-7894/? A/DEBUG: Build fingerprint: 'google/walleye/walleye:9/PPR2.181005.003/4984323:user/release-keys'
2018-10-16 10:57:05.268 7894-7894/? A/DEBUG: Revision: 'MP1'
2018-10-16 10:57:05.268 7894-7894/? A/DEBUG: ABI: 'arm'
2018-10-16 10:57:05.268 7894-7894/? A/DEBUG: pid: 7650, tid: 7891, name: GLThread 8661  >>> com.permobil.smarteval <<<
2018-10-16 10:57:05.268 7894-7894/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x58
2018-10-16 10:57:05.268 7894-7894/? A/DEBUG: Cause: null pointer dereference
2018-10-16 10:57:05.268 7894-7894/? A/DEBUG:     r0  cb877000  r1  000049a6  r2  00000000  r3  40000000
2018-10-16 10:57:05.268 7894-7894/? A/DEBUG:     r4  e363e518  r5  c64dba68  r6  00000000  r7  c057e800
2018-10-16 10:57:05.268 7894-7894/? A/DEBUG:     r8  00000000  r9  e178b600  r10 c057e900  r11 c78e2e00
2018-10-16 10:57:05.268 7894-7894/? A/DEBUG:     ip  e9a72d00  sp  c057e7f8  lr  c56fd221  pc  c56fd1f0
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG: backtrace:
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #00 pc 000261f0  /data/app/com.permobil.smarteval-InwI9vpywFWtqxXZ33ewaw==/lib/arm/libmapbox-gl.so
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #01 pc 0002621d  /data/app/com.permobil.smarteval-InwI9vpywFWtqxXZ33ewaw==/lib/arm/libmapbox-gl.so
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #02 pc 000dd3d3  /data/app/com.permobil.smarteval-InwI9vpywFWtqxXZ33ewaw==/lib/arm/libmapbox-gl.so
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #03 pc 00076c01  /data/app/com.permobil.smarteval-InwI9vpywFWtqxXZ33ewaw==/lib/arm/libmapbox-gl.so
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #04 pc 00076c2d  /data/app/com.permobil.smarteval-InwI9vpywFWtqxXZ33ewaw==/lib/arm/libmapbox-gl.so
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #05 pc 00074571  /data/app/com.permobil.smarteval-InwI9vpywFWtqxXZ33ewaw==/lib/arm/libmapbox-gl.so
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #06 pc 0005e7d7  /data/app/com.permobil.smarteval-InwI9vpywFWtqxXZ33ewaw==/lib/arm/libmapbox-gl.so
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #07 pc 00411a79  /system/lib/libart.so (art_quick_generic_jni_trampoline+40)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #08 pc 0040d575  /system/lib/libart.so (art_quick_invoke_stub_internal+68)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #09 pc 003e6b79  /system/lib/libart.so (art_quick_invoke_stub+224)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #10 pc 000a1015  /system/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+136)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #11 pc 001e5ae9  /system/lib/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+236)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #12 pc 001e05d7  /system/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+814)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #13 pc 003e2661  /system/lib/libart.so (MterpInvokeDirect+196)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #14 pc 00400414  /system/lib/libart.so (ExecuteMterpImpl+14484)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #15 pc 003b7868  /dev/ashmem/dalvik-classes2.dex extracted in memory from /data/app/com.permobil.smarteval-InwI9vpywFWtqxXZ33ewaw==/base.apk!classes2.dex (deleted) (com.mapbox.mapboxsdk.maps.renderer.MapRenderer.onSurfaceCreated)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #16 pc 001c4d53  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2471763592+378)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #17 pc 001c9439  /system/lib/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+152)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #18 pc 001e05bf  /system/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+790)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #19 pc 003e1cef  /system/lib/libart.so (MterpInvokeSuper+1098)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #20 pc 00400394  /system/lib/libart.so (ExecuteMterpImpl+14356)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #21 pc 003b83d4  /dev/ashmem/dalvik-classes2.dex extracted in memory from /data/app/com.permobil.smarteval-InwI9vpywFWtqxXZ33ewaw==/base.apk!classes2.dex (deleted) (com.mapbox.mapboxsdk.maps.renderer.glsurfaceview.GLSurfaceViewMapRenderer.onSurfaceCreated)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #22 pc 001c4d53  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2471763592+378)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #23 pc 001c9439  /system/lib/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+152)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #24 pc 001e05bf  /system/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+790)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #25 pc 003e1cef  /system/lib/libart.so (MterpInvokeSuper+1098)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #26 pc 00400394  /system/lib/libart.so (ExecuteMterpImpl+14356)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #27 pc 003ae4ce  /dev/ashmem/dalvik-classes2.dex extracted in memory from /data/app/com.permobil.smarteval-InwI9vpywFWtqxXZ33ewaw==/base.apk!classes2.dex (deleted) (com.mapbox.mapboxsdk.maps.MapView$5.onSurfaceCreated+10)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #28 pc 001c4d53  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2471763592+378)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #29 pc 001c9439  /system/lib/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+152)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #30 pc 001e05bf  /system/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+790)
2018-10-16 10:57:05.297 7894-7894/? A/DEBUG:     #31 pc 003e23a3  /system/lib/libart.so (MterpInvokeInterface+1010)

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Comments: 36 (20 by maintainers)

Most upvoted comments

Downgrading to 4.3.1 has stopped the crashing but the plugin no longer displays the userLocation. Any suggestions? I’ve been stuck with this since Monday 😦

While switching between pages, app crashes to (as mentioned in issue #275), solution for me was, to listen for the ā€œonNavigatingFromā€ event (Page docs) and when it’s triggered detach and destroy the map like I mentioned before.

From quick searching on mapbox repo here it looks like handling the app events might be a fix for this.

Testing out a few things in an app, if so, will provide PR to README with ways to handle.

@ShyshkovOleg A possibile temporary workaround suggested by a friend of mine may be showing the MapBox tag using an *ngIf directive bound to a boolean variable which is set to false on suspendEvent and true to resumeEvent.

Sadly, calling the lifecycle methods does not fix the problem /if/ the map is added as a child to any component in the view. It will still freeze/crash on resume.

However, if the map view is added to the top of the hierarchy, as I am doing in my test app then it works exactly as the native app and it does not crash even through dozens of interations.

If I try to add the map below any tag in the view, whether using a mapView in a Fragment, a mapView directly in a placeholder, or even a SupportMapFragment, the app will freeze and crash on resume.

Destroying the map completely onPause by removing the tag completely (i.e. *ngIf=ā€œshownā€ or some such) and then rebuilding it all on resume does work but not 100% of the time and there seems to be a memory leak.

The mapbox documentation explicitly states that the map lifecycle events have to be called directly from the containing activity. I don’t understand why that would have to be the case but even then it does not address this crash if added below any other tag.

I’m presently at a loss how to proceed tracking this down. I’d be grateful for any pointers.

Hi @simonettoa tried it with my other app -> same problem appeared. I think it’s the same as #181 . Maybe somewhere the javascript object doesn’t release the java binding so the GC couldn’t remove the instances…

Yeah, I’m going to write a small snippet tomorrow…

@stoanarrr Thanks for sharing! Brad and I were trying a similar approach with less luck. Can you share the actual implementation?

For others: roll back to 4.3.1 and you should be crash-free as well.