maplibre / maplibre-native

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

Android Annotation Plugin Version 3.0.1-pre1 crashes while rendering map #2849

Closed EllisGlaeser closed 1 month ago

EllisGlaeser commented 1 month ago

I updated the Annotation Plugin to 3.0.1-pre1 (with no other changes to my project to my knowledge) and it crashes after loading a few tiles. I was running Map Libre version 11.0.0, but I did also try it with 11.3.0.

I also took out the code that adds annotations to the map, so it was just rendering the map, nothing else. Stepping through the code, I confirmed that it did get through all of my initialization correctly (setting the map style, etc) and did reach our internal server that handles the tile requests.

This is the main error from the logs: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x30 in tid 19386 (GLThread 74), pid 19335

Below that I get:


2024-09-18 12:57:28.228 21632-21632 DEBUG                   pid-21632                            A        #06 pc 00000000004dac24  /data/app/~~fnD5Mkqr3uzicJ0xeAFnSw==/co.topomaps.dev-g3rdPYVkPgb9jcQMhA0NRQ==/base.apk!libmaplibre.so (offset 0x2bcc000) (mbgl::android::MapRenderer::render(_JNIEnv&)+192) (BuildId: 83ac463f6b31f38bd519357ac1cec43f1073dee2)
2024-09-18 12:57:28.228 21632-21632 DEBUG                   pid-21632                            A        #07 pc 00000000004ddae0  /data/app/~~fnD5Mkqr3uzicJ0xeAFnSw==/co.topomaps.dev-g3rdPYVkPgb9jcQMhA0NRQ==/base.apk!libmaplibre.so (offset 0x2bcc000) (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)
2024-09-18 12:57:28.228 21632-21632 DEBUG                   pid-21632                            A        #13 pc 0000000000093e2c  /data/app/~~fnD5Mkqr3uzicJ0xeAFnSw==/co.topomaps.dev-g3rdPYVkPgb9jcQMhA0NRQ==/base.apk (org.maplibre.android.maps.renderer.MapRenderer.onDrawFrame+0)
2024-09-18 12:57:28.228 21632-21632 DEBUG                   pid-21632                            A        #18 pc 0000000000095a60  /data/app/~~fnD5Mkqr3uzicJ0xeAFnSw==/co.topomaps.dev-g3rdPYVkPgb9jcQMhA0NRQ==/base.apk (org.maplibre.android.maps.renderer.glsurfaceview.GLSurfaceViewMapRenderer.onDrawFrame+0)
2024-09-18 12:57:28.228 21632-21632 DEBUG                   pid-21632                            A        #23 pc 000000000009614c  /data/app/~~fnD5Mkqr3uzicJ0xeAFnSw==/co.topomaps.dev-g3rdPYVkPgb9jcQMhA0NRQ==/base.apk (org.maplibre.android.maps.renderer.glsurfaceview.MapLibreGLSurfaceView$GLThread.guardedRun+0)
2024-09-18 12:57:28.228 21632-21632 DEBUG                   pid-21632                            A        #28 pc 0000000000096a80  /data/app/~~fnD5Mkqr3uzicJ0xeAFnSw==/co.topomaps.dev-g3rdPYVkPgb9jcQMhA0NRQ==/base.apk (org.maplibre.android.maps.renderer.glsurfaceview.MapLibreGLSurfaceView$GLThread.run+0)```
alasram commented 1 month ago

I had issues with the plugin but the following combination works fine: MapLibre android-v11.4.0 android-plugin-annotation-v9:3.0.1

Can you try it?

EllisGlaeser commented 1 month ago

Ah, I did not realize that version was out. I just tried it and it seemed to load more tiles before crashing, but I still get the crash and Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x30 in tid 22098 (RenderThread 75), pid 22038

louwers commented 1 month ago

@EllisGlaeser Could you provide the full stack trace?

EllisGlaeser commented 1 month ago

Here is the last tile request (there were a bunch before this) which successfully handles as the rest did, and then the errors. Did you need anything from before this?

2024-09-18 13:26:53.867 23004-23093 Tile                    co.topomaps.dev                      D  Requested 26/14/3267/6682
2024-09-18 13:26:53.867 23004-23093 MBTilesServer           co.topomaps.dev                      D  Handling Socket Request for 26/14/3267/6682
2024-09-18 13:26:53.868 23004-23093 MBTilesSource           co.topomaps.dev                      D  Found tile in package.
2024-09-18 13:26:53.868 23004-23093 Tile                    co.topomaps.dev                      D  Has local file for 14/3267/6682
2024-09-18 13:26:53.868 23004-23093 Tile                    co.topomaps.dev                      D  sending output for 14/3267/6682
2024-09-18 13:26:53.868 23004-23093 StandaloneCoroutine     co.topomaps.dev                      D  Request handled
2024-09-18 13:26:53.871 23004-23111 Mbgl-HttpRequest        co.topomaps.dev                      V  [HTTP] Request was successful (code = 200).
2024-09-18 13:26:53.886 23004-23062 libc                    co.topomaps.dev                      A  Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x30 in tid 23062 (RenderThread 74), pid 23004 (co.topomaps.dev)
2024-09-18 13:26:53.886 23004-23053 Mbgl-HttpRequest        co.topomaps.dev                      D  [HTTP] This request was cancelled (http://localhost:34133/26/14/3267/6682.png). This is expected for tiles that were being prefetched but are no longer needed for the map to render.
---------------------------- PROCESS STARTED (23118) for package co.topomaps.dev ----------------------------
2024-09-18 13:26:54.197 23004-23014 co.topomaps.dev         co.topomaps.dev                      I  NativeAlloc concurrent copying GC freed 650619(26MB) AllocSpace objects, 85(2164KB) LOS objects, 49% free, 20MB/41MB, paused 1.387ms,35us total 398.732ms
2024-09-18 13:26:54.308 23116-23116 DEBUG                   crash_dump64                         A  Cmdline: co.topomaps.dev
2024-09-18 13:26:54.308 23116-23116 DEBUG                   crash_dump64                         A  pid: 23004, tid: 23062, name: RenderThread 74  >>> co.topomaps.dev <<<
2024-09-18 13:26:54.309 23116-23116 DEBUG                   crash_dump64                         A        #01 pc 0000000000895504  /data/app/~~DL8usa4O3C5RXiimE4t4Jw==/co.topomaps.dev-KMyZjlOQDT9jzMyEOR5r-Q==/base.apk!libmaplibre.so (offset 0x2ee0000) (BuildId: 22192c5c0c6eab5ffd04419f3cc279ef1e6e6708)
2024-09-18 13:26:54.309 23116-23116 DEBUG                   crash_dump64                         A        #02 pc 00000000008b3bd8  /data/app/~~DL8usa4O3C5RXiimE4t4Jw==/co.topomaps.dev-KMyZjlOQDT9jzMyEOR5r-Q==/base.apk!libmaplibre.so (offset 0x2ee0000) (BuildId: 22192c5c0c6eab5ffd04419f3cc279ef1e6e6708)
2024-09-18 13:26:54.309 23116-23116 DEBUG                   crash_dump64                         A        #03 pc 00000000008b4e24  /data/app/~~DL8usa4O3C5RXiimE4t4Jw==/co.topomaps.dev-KMyZjlOQDT9jzMyEOR5r-Q==/base.apk!libmaplibre.so (offset 0x2ee0000) (BuildId: 22192c5c0c6eab5ffd04419f3cc279ef1e6e6708)
2024-09-18 13:26:54.309 23116-23116 DEBUG                   crash_dump64                         A        #04 pc 00000000006ccfc4  /data/app/~~DL8usa4O3C5RXiimE4t4Jw==/co.topomaps.dev-KMyZjlOQDT9jzMyEOR5r-Q==/base.apk!libmaplibre.so (offset 0x2ee0000) (BuildId: 22192c5c0c6eab5ffd04419f3cc279ef1e6e6708)
2024-09-18 13:26:54.309 23116-23116 DEBUG                   crash_dump64                         A        #05 pc 00000000006cb530  /data/app/~~DL8usa4O3C5RXiimE4t4Jw==/co.topomaps.dev-KMyZjlOQDT9jzMyEOR5r-Q==/base.apk!libmaplibre.so (offset 0x2ee0000) (BuildId: 22192c5c0c6eab5ffd04419f3cc279ef1e6e6708)
2024-09-18 13:26:54.309 23116-23116 DEBUG                   crash_dump64                         A        #06 pc 00000000004dc5f4  /data/app/~~DL8usa4O3C5RXiimE4t4Jw==/co.topomaps.dev-KMyZjlOQDT9jzMyEOR5r-Q==/base.apk!libmaplibre.so (offset 0x2ee0000) (mbgl::android::MapRenderer::render(_JNIEnv&)+216) (BuildId: 22192c5c0c6eab5ffd04419f3cc279ef1e6e6708)
2024-09-18 13:26:54.309 23116-23116 DEBUG                   crash_dump64                         A        #07 pc 00000000004df804  /data/app/~~DL8usa4O3C5RXiimE4t4Jw==/co.topomaps.dev-KMyZjlOQDT9jzMyEOR5r-Q==/base.apk!libmaplibre.so (offset 0x2ee0000) (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: 22192c5c0c6eab5ffd04419f3cc279ef1e6e6708)
2024-09-18 13:26:54.309 23116-23116 DEBUG                   crash_dump64                         A        #13 pc 00000000001141b4  /data/app/~~DL8usa4O3C5RXiimE4t4Jw==/co.topomaps.dev-KMyZjlOQDT9jzMyEOR5r-Q==/base.apk (org.maplibre.android.maps.renderer.MapRenderer.onDrawFrame+0)
2024-09-18 13:26:54.309 23116-23116 DEBUG                   crash_dump64                         A        #18 pc 00000000001174ac  /data/app/~~DL8usa4O3C5RXiimE4t4Jw==/co.topomaps.dev-KMyZjlOQDT9jzMyEOR5r-Q==/base.apk (org.maplibre.android.maps.renderer.surfaceview.SurfaceViewMapRenderer.onDrawFrame+0)
2024-09-18 13:26:54.309 23116-23116 DEBUG                   crash_dump64                         A        #23 pc 000000000011620c  /data/app/~~DL8usa4O3C5RXiimE4t4Jw==/co.topomaps.dev-KMyZjlOQDT9jzMyEOR5r-Q==/base.apk (org.maplibre.android.maps.renderer.surfaceview.MapLibreGLSurfaceView$GLThread.guardedRun+0)
2024-09-18 13:26:54.309 23116-23116 DEBUG                   crash_dump64                         A        #28 pc 0000000000116e70  /data/app/~~DL8usa4O3C5RXiimE4t4Jw==/co.topomaps.dev-KMyZjlOQDT9jzMyEOR5r-Q==/base.apk (org.maplibre.android.maps.renderer.surfaceview.MapLibreSurfaceView$RenderThread.run+0)
louwers commented 1 month ago

This is with 11.4.0 right? Are you using a arm64-v8a device?

Then it's this line

https://github.com/maplibre/maplibre-native/blob/77a464d3355a65b54972b2ade48a8e80d7df049b/src/mbgl/gl/context.cpp#L818-L821

EllisGlaeser commented 1 month ago

I believe I had 11.4.0 running for that, yes. I've tried it both ways with the same result

louwers commented 1 month ago

Any chance you could share a reproducer project?

EllisGlaeser commented 1 month ago

@louwers Hmm, I can't get it to reproduce in a sample project. I do think that it might have to do with the Android Emulator, as I cannot reproduce it on my physical device either.

louwers commented 1 month ago

@EllisGlaeser Ah yes this is a known issue.

https://github.com/maplibre/maplibre-native/issues/2791