maplibre / maplibre-native

MapLibre Native - Interactive vector tile maps for iOS, Android and other platforms.
https://maplibre.org
BSD 2-Clause "Simplified" License
1.06k stars 310 forks source link

Map crashing in 11.5.0 on Android #2905

Open nijs9 opened 3 weeks ago

nijs9 commented 3 weeks ago

Describe the bug In Android SDK 11.5.0, the app crashes consistently after a few seconds. I am only using a simple map view, without any extra layers or features. This does not happen in version 11.1.0. The map opens, and after a few seconds, the app crashes completely with this stack trace:

_tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE) pac_enabled_keys: 000000000000000f (PR_PAC_APIAKEY, PR_PAC_APIBKEY, PR_PAC_APDAKEY, PR_PAC_APDBKEY) signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0000000000000030 Cause: null pointer dereference x0 0000000000000000 x1 b400007b928f7648 x2 b400007b928f7648 x3 0000000000001403 x4 0000000000000000 x5 0000007a8be98fbc x6 0000000000000000 x7 0000000000000000 x8 0000000000000001 x9 0000000000000000 x10 0000000000000001 x11 0000000000000000 x12 0000000000000000 x13 000000000000000d x14 0000000000000000 x15 0000000000000ab5 x16 0000000000000001 x17 0000007d6bb2778c x18 00000078f441a000 x19 b400007c2294ff40 x20 0000000000001403 x21 000000000000006c x22 0000000000000004 x23 0000000000000000 x24 0000000000000000 x25 000000000000006c x26 0000000000000048 x27 00000078f502f000 x28 0000000000000000 x29 00000078f502deb0 lr 0000007a8be99188 sp 00000078f502de90 pc 0000007a8be99190 pst 0000000080001000 backtrace:

00 pc 0000000000032190 /vendor/lib64/libGLESv2_enc.so (GL2Encoder::s_glDrawElements(void, unsigned int, int, unsigned int, void const)+468) (BuildId: a27664df0c89ccdb6da110c4b80f92f7)

  #01 pc 00000000008838fc  /data/app/~~OPUNEaoXetvfWPFBowUmoA==/be.wand-r94mLnHq9bN3uy6EtR_DlA==/lib/arm64/libmaplibre.so (BuildId: 83ac463f6b31f38bd519357ac1cec43f1073dee2)
  #02 pc 00000000008b0240  /data/app/~~OPUNEaoXetvfWPFBowUmoA==/be.wand-r94mLnHq9bN3uy6EtR_DlA==/lib/arm64/libmaplibre.so (BuildId: 83ac463f6b31f38bd519357ac1cec43f1073dee2)
  #03 pc 00000000008b148c  /data/app/~~OPUNEaoXetvfWPFBowUmoA==/be.wand-r94mLnHq9bN3uy6EtR_DlA==/lib/arm64/libmaplibre.so (BuildId: 83ac463f6b31f38bd519357ac1cec43f1073dee2)
  #04 pc 00000000006b89d8  /data/app/~~OPUNEaoXetvfWPFBowUmoA==/be.wand-r94mLnHq9bN3uy6EtR_DlA==/lib/arm64/libmaplibre.so (BuildId: 83ac463f6b31f38bd519357ac1cec43f1073dee2)
  #05 pc 00000000006b6f44  /data/app/~~OPUNEaoXetvfWPFBowUmoA==/be.wand-r94mLnHq9bN3uy6EtR_DlA==/lib/arm64/libmaplibre.so (BuildId: 83ac463f6b31f38bd519357ac1cec43f1073dee2)
  #06 pc 00000000004dac24  /data/app/~~OPUNEaoXetvfWPFBowUmoA==/be.wand-r94mLnHq9bN3uy6EtR_DlA==/lib/arm64/libmaplibre.so (mbgl::android::MapRenderer::render(_JNIEnv&)+192) (BuildId: 83ac463f6b31f38bd519357ac1cec43f1073dee2)
  #07 pc 00000000004ddae0  /data/app/~~OPUNEaoXetvfWPFBowUmoA==/be.wand-r94mLnHq9bN3uy6EtR_DlA==/lib/arm64/libmaplibre.so (auto auto jni::MakeNativeMethod<auto jni::NativeMethodMaker<void (auto jni::NativePeerMemberFunctionMethod<void (mbgl::android::MapRenderer::*)(_JNIEnv&), &(mbgl::android::MapRenderer::render(_JNIEnv&))>::operator()<mbgl::android::MapRenderer, mbgl::android::MapRenderer, void>(jni::Field<mbgl::android::MapRenderer, long> const&)::'lambda'(_JNIEnv&, jni::Object<mbgl::android::MapRenderer>&)::*)(_JNIEnv&, jni::Object<mbgl::android::MapRenderer>&) const>::operator()<auto jni::NativePeerMemberFunctionMethod<void (mbgl::android::MapRenderer::*)(_JNIEnv&), &(mbgl::android::MapRenderer::render(_JNIEnv&))>::operator()<mbgl::android::MapRenderer, mbgl::android::MapRenderer, void>(jni::Field<mbgl::android::MapRenderer, long> const&)::'lambda'(_JNIEnv&, jni::Object<mbgl::android::MapRenderer>&)>(char const*, auto jni::NativePeerMemberFunctionMethod<void (mbgl::android::MapRenderer::*)(_JNIEnv&), &(mbgl::android::MapRenderer::render(_JNIEnv&))>::operator()<mbgl::android::MapRenderer, mbgl::android::MapRenderer, void>(jni::Field<mbgl::android::MapRenderer, long> const&)::'lambda'(_JNIEnv&, jni::Object<mbgl::android::MapRenderer>&) const&)::'lambda'(_JNIEnv*, jni::jobject*)>(char const*, char const*, auto jni::NativePeerMemberFunctionMethod<void (mbgl::android::MapRenderer::*)(_JNIEnv&), &(mbgl::android::MapRenderer::render(_JNIEnv&))>::operator()<mbgl::android::MapRenderer, mbgl::android::MapRenderer, void>(jni::Field<mbgl::android::MapRenderer, long> const&)::'lambda'(_JNIEnv&, jni::Object<mbgl::android::MapRenderer>&) const&, std::__ndk1::enable_if<std::is_class<auto jni::NativePeerMemberFunctionMethod<void (mbgl::android::MapRenderer::*)(_JNIEnv&), &(mbgl::android::MapRenderer::render(_JNIEnv&))>::operator()<mbgl::android::MapRenderer, mbgl::android::MapRenderer, void>(jni::Field<mbgl::android::MapRenderer, long> const&)::'lambda'(_JNIEnv&, jni::Object<mbgl::android::MapRenderer>&)>::value, void>::type*)::'lambda'(_JNIEnv*, auto...)::__invoke<jni::jobject*>(_JNIEnv*, auto...)+44) (BuildId: 83ac463f6b31f38bd519357ac1cec43f1073dee2)
  #08 pc 0000000000461d54  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+148) (BuildId: 4c9b59b74ca9272f710a71137164c349)
  #09 pc 000000000020a2b0  /apex/com.android.art/lib64/libart.so (nterp_helper+4016) (BuildId: 4c9b59b74ca9272f710a71137164c349)
  #10 pc 00000000003f77ac  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~OPUNEaoXetvfWPFBowUmoA==/be.wand-r94mLnHq9bN3uy6EtR_DlA==/base.apk!classes6.dex] (org.maplibre.android.maps.renderer.MapRenderer.onDrawFrame+12)
  #11 pc 000000000020a254  /apex/com.android.art/lib64/libart.so (nterp_helper+3924) (BuildId: 4c9b59b74ca9272f710a71137164c349)
  #12 pc 00000000003f947c  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~OPUNEaoXetvfWPFBowUmoA==/be.wand-r94mLnHq9bN3uy6EtR_DlA==/base.apk!classes6.dex] (org.maplibre.android.maps.renderer.glsurfaceview.GLSurfaceViewMapRenderer.onDrawFrame+0)
  #13 pc 000000000020b120  /apex/com.android.art/lib64/libart.so (nterp_helper+7712) (BuildId: 4c9b59b74ca9272f710a71137164c349)
  #14 pc 00000000003f9f22  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~OPUNEaoXetvfWPFBowUmoA==/be.wand-r94mLnHq9bN3uy6EtR_DlA==/base.apk!classes6.dex] (org.maplibre.android.maps.renderer.glsurfaceview.MapLibreGLSurfaceView$GLThread.guardedRun+994)
  #15 pc 000000000020a254  /apex/com.android.art/lib64/libart.so (nterp_helper+3924) (BuildId: 4c9b59b74ca9272f710a71137164c349)
  #16 pc 00000000003fa4a8  [anon:dalvik-classes6.dex extracted in memory from /data/app/~~OPUNEaoXetvfWPFBowUmoA==/be.wand-r94mLnHq9bN3uy6EtR_DlA==/base.apk!classes6.dex] (org.maplibre.android.maps.renderer.glsurfaceview.MapLibreGLSurfaceView$GLThread.run+52)
  #17 pc 000000000045836c  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+556) (BuildId: 4c9b59b74ca9272f710a71137164c349)
  #18 pc 00000000004841e4  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+156) (BuildId: 4c9b59b74ca9272f710a71137164c349)
  #19 pc 0000000000483eb0  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithJValues<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, jvalue const*)+400) (BuildId: 4c9b59b74ca9272f710a71137164c349)
  #20 pc 00000000005cc668  /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallback(void*)+1680) (BuildId: 4c9b59b74ca9272f710a71137164c349)
  #21 pc 00000000000b63b0  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208) (BuildId: 4e07915368c859b1910c68c84a8de75f)
  #22 pc 00000000000530b8  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 4e07915368c859b1910c68c84a8de75f)_

To Reproduce Steps to reproduce the behavior:

  1. Open a simple fullscreen map on an Android device

Platform information (please complete the following information):

westnordost commented 3 weeks ago

What device are you testing with? (MapLibre 11.x.x+ requires OpenGL ES 3.0. Whether it is supported or not depends on the device used.)

nijs9 commented 3 weeks ago

@westnordost Galaxy A23 5G SM-A263B/DSN Android 14. In Android emulator Pixel 8 API 35 crash is also happening.

westnordost commented 3 weeks ago

To test whether this is an OpenGL-specific issue, can you reproduce this with org.maplibre.gl:android-sdk:11.3.0-vulkan-pre0? To check whether this only occurs on Android 14, can you check if it is reproducible on a device with an older Android?

nijs9 commented 3 weeks ago

@westnordost I can confirm that the issue does not occur with org.maplibre.gl:android-sdk:11.3.0-vulkan-pre0. With this version, it works on the device, and in the emulator (on Android 13 and 14).

Edit: I'm wrong. Crash is also happening with this version, in this case I can pan a little bit before the crash is happening.

Edit: I changed to another vector tile provider, and now crash is not happening with 11.5.0. Is it possible the vector style is causing the crash?

westnordost commented 3 weeks ago

So, I understand it also occurs for the Vulkan rendering backend and it occurs for different Android versions.

Is it possible the vector style is causing the crash?

To find a way to reproduce this issue for MapLibre developers (I am not one, I am just doing a bit of triage issue here), it would be helpful to know the map tile provider and the location at which this is happening (I.e. at what location is the camera looking at at the point of crash). It certainly shouldn't cause a crash, i.e. MapLibre should be robust against possibly invalid vector tile data, but there could be a bug.

nijs9 commented 3 weeks ago

So, I understand it also occurs for the Vulkan rendering backend and it occurs for different Android versions.

Yes indeed. I also notice, by the way, that in Vulkan, all styles from the providers (one of them being StadiaMaps Alidade Smooth Dark) crash, while in 11.5.0 the StadiaMaps style renders correctly and does not crash, but the others do. In 11.1.0, none of the styles crash.

I will inform the person who created the vector style in question and ask if they can provide more information.

westnordost commented 3 weeks ago

I think it is better to report this as a new issue. That one should be pretty straightforward to reproduce and there's currently a push to make the Vulkan renderer stable ASAP.

louwers commented 4 days ago

Could you try the newest version?