[Android] Adding annotations bug
There is native bug Fatal signal 6 (SIGABRT), code -6 in tid 28455 (Map Thread) when I'm trying to add 18 polylines and 18 polygons while camera is being animated. Flow is like that:
- Start app
- Animate camera to specified point (from default zoom to 14, duration is 1000ms)
- When zoom is > 13 I'm adding annotations (trigger it only once) - animation is still working
- Sometimes there is a crash, sometimes it's ok
Here are examples of my logs:
03-16 12:20:47.820 MapObserver: Zoom: 13.95637035369873
03-16 12:20:47.823 MapPresenter: Show annotations
03-16 12:20:47.927 A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 8415 (Map Thread)
---
03-16 12:26:07.278 MapObserver: Zoom: 13.813736915588379
03-16 12:26:07.281 MapPresenter: Show annotations
03-16 12:26:07.336 A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 18286 (Map Thread)
Correct one:
03-16 12:22:45.719 MapObserver: Zoom: 13.859857559204102
03-16 12:22:45.721 MapPresenter: Show annotations
03-16 12:22:46.044 MapObserver: Zoom: 14.0
03-16 12:22:46.046 MapObserver: Zoom: 14.0
I hope you'll be able to reproduce it. I'm not sure if it's because of animation, but looks like it could be a problem.
I observe camera using onCameraChangeListener(CameraPosition cameraPosition) and getCameraPosition() (#4326)
Thank you for reaching out and reporting this issue, could you let us know which version of the library you are using?
update now seeing onCameraChangeListener(CameraPosition cameraPosition).
So this means you are using 4.0.0.
I'm using com.mapbox.mapboxsdk:mapbox-android-sdk:4.0.0-SNAPSHOT@aar and haven't tried beta release yet.
@mpuchala that will probably give same results, I will try reproduce locally and see what that crash is.
I guess it would be the same situation, if you need more info feel free.
Maybe log would be helpful (4.0.0-beta2)
03-22 10:37:47.345 189-189/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
03-22 10:37:47.345 189-189/? I/DEBUG: Build fingerprint: 'google/occam/mako:5.1.1/LMY48T/2237560:user/release-keys'
03-22 10:37:47.345 189-189/? I/DEBUG: Revision: '11'
03-22 10:37:47.345 189-189/? I/DEBUG: ABI: 'arm'
03-22 10:37:47.346 189-189/? I/DEBUG: pid: 1308, tid: 1552, name: Map Thread >>> ... <<<
03-22 10:37:47.346 189-189/? I/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
03-22 10:37:47.426 189-189/? I/DEBUG: r0 00000000 r1 00000610 r2 00000006 r3 00000000
03-22 10:37:47.426 189-189/? I/DEBUG: r4 9eeebdd8 r5 00000006 r6 0000000b r7 0000010c
03-22 10:37:47.426 189-189/? I/DEBUG: r8 00000001 r9 fffff488 sl 00000000 fp 9eee6c08
03-22 10:37:47.426 189-189/? I/DEBUG: ip 00000610 sp 9eee6ba8 lr b6e35989 pc b6e5ae24 cpsr 600d0010
03-22 10:37:47.427 189-189/? I/DEBUG: backtrace:
03-22 10:37:47.427 189-189/? I/DEBUG: #00 pc 0003be24 /system/lib/libc.so (tgkill+12)
03-22 10:37:47.427 189-189/? I/DEBUG: #01 pc 00016985 /system/lib/libc.so (pthread_kill+52)
03-22 10:37:47.427 189-189/? I/DEBUG: #02 pc 00017597 /system/lib/libc.so (raise+10)
03-22 10:37:47.427 189-189/? I/DEBUG: #03 pc 00013d3d /system/lib/libc.so (__libc_android_abort+36)
03-22 10:37:47.427 189-189/? I/DEBUG: #04 pc 000124ec /system/lib/libc.so (abort+4)
03-22 10:37:47.427 189-189/? I/DEBUG: #05 pc 003f3530 /data/app/.../lib/arm/libmapbox-gl.so
03-22 10:37:47.427 189-189/? I/DEBUG: #06 pc 003f3660 /data/app/.../lib/arm/libmapbox-gl.so
03-22 10:37:47.427 189-189/? I/DEBUG: #07 pc 003e3cb8 /data/app/.../lib/arm/libmapbox-gl.so
03-22 10:37:47.427 189-189/? I/DEBUG: #08 pc 003e2ef4 /data/app/.../lib/arm/libmapbox-gl.so (__cxa_throw+240)
03-22 10:37:47.427 189-189/? I/DEBUG: #09 pc 0043329c /data/app/.../lib/arm/libmapbox-gl.so (mapbox::geojsonvt::Convert::calcBBox(mapbox::geojsonvt::ProjectedFeature&)+460)
03-22 10:37:47.427 189-189/? I/DEBUG: #10 pc 00432ad0 /data/app/.../lib/arm/libmapbox-gl.so (_ZN6mapbox9geojsonvt7Convert6createENSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEES9_NS2_4lessIS9_EENS7_INS2_4pairIKS9_S9_EEEEEENS0_20ProjectedFeatureTypeENS_4util7variantIJNS2_6vectorINS0_14ProjectedPointENS7_ISL_EEEENSK_INS0_13ProjectedRingENS7_ISO_EEEEEEE+332)
03-22 10:37:47.427 189-189/? I/DEBUG: #11 pc 0016442c /data/app/.../lib/arm/libmapbox-gl.so (mbgl::ShapeAnnotationImpl::updateTile(mbgl::TileID const&, mbgl::AnnotationTile&)+848)
03-22 10:37:47.427 189-189/? I/DEBUG: #12 pc 0016ab90 /data/app/.../lib/arm/libmapbox-gl.so (mbgl::AnnotationManager::getTile(mbgl::TileID const&)+396)
03-22 10:37:47.428 189-189/? I/DEBUG: #13 pc 0016b450 /data/app/.../lib/arm/libmapbox-gl.so (mbgl::AnnotationManager::addTileMonitor(mbgl::AnnotationTileMonitor&)+268)
03-22 10:37:47.428 189-189/? I/DEBUG: #14 pc 00162ee4 /data/app/.../lib/arm/libmapbox-gl.so (mbgl::AnnotationTileMonitor::monitorTile(std::__1::function<void (std::exception_ptr, std::__1::unique_ptr<mbgl::GeometryTile, std::__1::default_delete<mbgl::GeometryTile> >, std::experimental::__library_fundamentals_v1::optional<std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1ll, 1000000ll> > > >, std::experimental::__library_fundamentals_v1::opt
03-22 10:37:47.428 189-189/? I/DEBUG: #15 pc 0011d560 /data/app/.../lib/arm/libmapbox-gl.so (mbgl::VectorTileData::VectorTileData(mbgl::TileID const&, std::__1::unique_ptr<mbgl::GeometryTileMonitor, std::__1::default_delete<mbgl::GeometryTileMonitor> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, mbgl::Style&, mbgl::MapMode, std::__1::function<void (std::exception_ptr)> const&)+688)
03-22 10:37:47.428 189-189/? I/DEBUG: #16 pc 001c086c /data/app/.../lib/arm/libmapbox-gl.so (_ZNSt3__110shared_ptrIN4mbgl14VectorTileDataEE11make_sharedIJRKNS1_6TileIDENS_10unique_ptrINS1_19GeometryTileMonitorENS_14default_deleteIS9_EEEERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERNS1_5StyleERKNS1_7MapModeERNS_6__bindIMNS1_6SourceEFvS7_St13exception_ptrbEJPSR_S7_RNS_12placeholders4__phILi1EEEbEEEEEES3_DpOT_+448)
03-22 10:37:47.428 189-189/? I/DEBUG: #17 pc 001be898 /data/app/.../lib/arm/libmapbox-gl.so (mbgl::Source::addTile(mbgl::TileID const&, mbgl::StyleUpdateParameters const&)+1072)
03-22 10:37:47.428 189-189/? I/DEBUG: #18 pc 001bf290 /data/app/.../lib/arm/libmapbox-gl.so (mbgl::Source::update(mbgl::StyleUpdateParameters const&)+560)
03-22 10:37:47.428 189-189/? I/DEBUG: #19 pc 001e31d0 /data/app/.../lib/arm/libmapbox-gl.so (mbgl::Style::update(mbgl::TransformState const&, mbgl::gl::TexturePool&)+200)
03-22 10:37:47.428 189-189/? I/DEBUG: #20 pc 001b6178 /data/app/.../lib/arm/libmapbox-gl.so (mbgl::MapContext::update()+316)
03-22 10:37:47.428 189-189/? I/DEBUG: #21 pc 0037d144 /data/app/.../lib/arm/libmapbox-gl.so
03-22 10:37:47.428 189-189/? I/DEBUG: #22 pc 0037d370 /data/app/.../lib/arm/libmapbox-gl.so
03-22 10:37:47.428 189-189/? I/DEBUG: #23 pc 0038693c /data/app/.../lib/arm/libmapbox-gl.so
03-22 10:37:47.428 189-189/? I/DEBUG: #24 pc 0037d8d8 /data/app/.../lib/arm/libmapbox-gl.so (uv_run+428)
03-22 10:37:47.428 189-189/? I/DEBUG: #25 pc 001b33f0 /data/app/.../lib/arm/libmapbox-gl.so (_ZN4mbgl4util6ThreadINS_10MapContextEE3runINSt3__15tupleIJRNS_4ViewERNS_10FileSourceERNS_7MapModeERNS_13GLContextModeEfEEEJLj0ELj1ELj2ELj3ELj4EEEEvNS0_13ThreadContextEOT_NS5_16integer_sequenceIjJXspT0_EEEE+120)
03-22 10:37:47.428 189-189/? I/DEBUG: #26 pc 001b3304 /data/app/.../lib/arm/libmapbox-gl.so (_ZZN4mbgl4util6ThreadINS_10MapContextEEC1IJRNS_4ViewERNS_10FileSourceERNS_7MapModeERNS_13GLContextModeEfEEERKNS0_13ThreadContextEDpOT_ENKUlvE_clEv+236)
03-22 10:37:47.428 189-189/? I/DEBUG: #27 pc 001b31c8 /data/app/.../lib/arm/libmapbox-gl.so (_ZNSt3__114__thread_proxyINS_5tupleIJZN4mbgl4util6ThreadINS2_10MapContextEEC1IJRNS2_4ViewERNS2_10FileSourceERNS2_7MapModeERNS2_13GLContextModeEfEEERKNS3_13ThreadContextEDpOT_EUlvE_EEEEEPvSO_+88)
03-22 10:37:47.428 189-189/? I/DEBUG: #28 pc 00016173 /system/lib/libc.so (__pthread_start(void*)+30)
03-22 10:37:47.428 189-189/? I/DEBUG: #29 pc 0001409b /system/lib/libc.so (__start_thread+6)
Same crash trace as #3926 on iOS.
According to my latests tests it's related to zooming and adding/modifying annotations at the same time (I'm not sure if kind of them is important). Now I have a lot of markers (100-200) with different icons (sth like 20) and some polygons/polylines but unfortunately app crashes quite often (another thing is that according to my first post it's probably not about amount).
The only solution I found until now is to have a map observer which has a variable like boolean mIsCameraAnimation, set it manually when animation starts and using MapboxMap.CancelableCallback to get info when it's finished. After that I modify my annotations. In this scenario it seems to be ok, but for sure it's not the best and safest solution.
EDIT: Forgot to mention that if I delay refreshing markers (ex. 100ms) it works much more stable (despite the visible "lag").
This should be fixed with the upgrade to geojson-vt-cpp 6.1.0. We expect that to be included with iOS 3.4.0 and Android 4.2.0.