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

Issues with MGLMapView.visibleAnnotations accuracy and stability #10844

Closed

Description

@friedbunny

On master circa 10a4405 (pre-ios-v4.0.0), using iosapp’s Reuse Queue Stats HUD to show visible and queued view annotation produces wildly inaccurate numbers and occasionally crashes. This is a regression since v3.7.x.

Inaccurate visibleAnnotations results

  1. Enable Show Reuse Queue Stats in iosapp’s settings menu.
  2. Load 10,000 view annotations.
  3. Zoom in and pan around — the stats should show up to 10k annotations, but instead fluctuate much lower (sometimes by a factor of 150×) despite the same number of annotations being visible.

As iosapp simply calls out to MGLMapView.visibleAnnotations for this number, this indicates an underlying issue with that method and/or its core implementation.

inaccurate_stats

Crash with std::out_of_range: vector

I can’t reliably reproduce this crash — it seems to happen after loading many thousands of view and/or image annotations. Here’s a trace captured via a C++ breakpoint:

libc++abi.dylib: terminating with uncaught exception of type std::out_of_range: vector
thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.2
    frame #0: 0x000000018520be20 libc++abi.dylib`__cxa_throw
    frame #1: 0x00000001851c70cc libc++.1.dylib`std::__1::__vector_base_common<true>::__throw_out_of_range() const + 76
  * frame #2: 0x0000000104d74250 Mapbox`std::__1::vector<std::__1::shared_ptr<mbgl::AnnotationTileFeatureData const>, std::__1::allocator<std::__1::shared_ptr<mbgl::AnnotationTileFeatureData const> > >::at(this=0x00000001d42922d0 size=1, __n=63) at vector:1513
    frame #3: 0x0000000104d73e8c Mapbox`mbgl::AnnotationTileLayer::getFeature(this=0x00000001d1431ce0, i=63) const at annotation_tile.cpp:83
    frame #4: 0x0000000104d8d0f4 Mapbox`mbgl::FeatureIndex::addFeature(this=0x00000001d4145ac0, result=size=0, indexedFeature=0x00000001d03922e0, queryGeometry=0x000000016bc895a0, options=0x000000016bc8c770, geometryTileData=0x00000001d5849a20, tileID=0x000000016bc8925c, layers=size=1, bearing=0, pixelsToTileUnits=10.3364401) const at feature_index.cpp:119
    frame #5: 0x0000000104d8ca30 Mapbox`mbgl::FeatureIndex::query(this=0x00000001d4145ac0, result=size=0, queryGeometry=0x000000016bc895a0, bearing=0, tileSize=512, scale=1.5479217236941738, queryOptions=0x000000016bc8c770, geometryTileData=0x00000001d5849a20, tileID=0x000000016bc89258, sourceID="com.mapbox.annotations", layers=size=1, collisionIndex=0x000000012612b730, additionalQueryRadius=0) const at feature_index.cpp:81
    frame #6: 0x00000001053136ec Mapbox`mbgl::GeometryTile::queryRenderedFeatures(this=0x000000012e8963f0, result=size=0, queryGeometry=0x000000016bc895a0, transformState=0x0000000112816a80, layers=size=1, options=0x000000016bc8c770, collisionIndex=0x000000012612b730) at geometry_tile.cpp:235
    frame #7: 0x0000000105026c78 Mapbox`mbgl::TilePyramid::queryRenderedFeatures(this=0x00000001d0123868, geometry=0x000000016bc8c068, transformState=0x0000000112816a80, layers=size=1, options=0x000000016bc8c770, collisionIndex=0x000000012612b730) const at tile_pyramid.cpp:283
    frame #8: 0x0000000104d81cb0 Mapbox`mbgl::RenderAnnotationSource::queryRenderedFeatures(this=0x00000001d0123840, geometry=0x000000016bc8c068, transformState=0x0000000112816a80, layers=size=1, options=0x000000016bc8c770, collisionIndex=0x000000012612b730) const at render_annotation_source.cpp:69
    frame #9: 0x0000000104fb4f38 Mapbox`mbgl::Renderer::Impl::queryRenderedFeatures(this=0x0000000112816a00, geometry=0x000000016bc8c068, options=0x000000016bc8c770, layers=size=1) const at renderer_impl.cpp:670
    frame #10: 0x0000000104fb35e4 Mapbox`mbgl::Renderer::Impl::queryRenderedFeatures(this=0x0000000112816a00, geometry=0x000000016bc8c068, options=0x000000016bc8c770) const at renderer_impl.cpp:658
    frame #11: 0x0000000104f9dae8 Mapbox`mbgl::Renderer::queryRenderedFeatures(this=0x00000001cc0167f0, box=0x000000016bc8c8f8, options=0x000000016bc8c770) const at renderer.cpp:45
    frame #12: 0x0000000104f9e24c Mapbox`mbgl::Renderer::queryPointAnnotations(this=0x00000001cc0167f0, box=0x000000016bc8c8f8) const at renderer.cpp:60
    frame #13: 0x0000000104c04034 Mapbox`::-[MGLMapView annotationTagsInRect:](self=0x000000011002ea00, _cmd="annotationTagsInRect:", rect=(origin = (x = 0, y = 0), size = (width = 375, height = 778))) at MGLMapView.mm:4200
    frame #14: 0x0000000104bfb968 Mapbox`::-[MGLMapView visibleAnnotationsInRect:](self=0x000000011002ea00, _cmd="visibleAnnotationsInRect:", rect=(origin = (x = 0, y = 0), size = (width = 375, height = 778))) at MGLMapView.mm:3547
    frame #15: 0x0000000104bfb8a4 Mapbox`::-[MGLMapView visibleAnnotations](self=0x000000011002ea00, _cmd="visibleAnnotations") at MGLMapView.mm:3537
    frame #16: 0x0000000104193804 Mapbox GL`-[MBXViewController updateHUD](self=0x000000010e60c7d0, _cmd="updateHUD") at MBXViewController.m:1966
    frame #17: 0x0000000104193398 Mapbox GL`-[MBXViewController mapViewRegionIsChanging:](self=0x000000010e60c7d0, _cmd="mapViewRegionIsChanging:", mapView=0x000000011002ea00) at MBXViewController.m:1943
    frame #18: 0x0000000104c11028 Mapbox`::-[MGLMapView cameraIsChanging](self=0x000000011002ea00, _cmd="cameraIsChanging") at MGLMapView.mm:5410
    frame #19: 0x0000000104c19100 Mapbox`MBGLView::onCameraIsChanging(this=0x00000001c005cb90) at MGLMapView.mm:6020
    frame #20: 0x0000000104c19c9c Mapbox`non-virtual thunk to MBGLView::onCameraIsChanging(this=0x00000001c005cb90) at MGLMapView.mm:0
    ...
Click for slightly longer log.
thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.2
    frame #0: 0x000000018520be20 libc++abi.dylib`__cxa_throw
    frame #1: 0x00000001851c70cc libc++.1.dylib`std::__1::__vector_base_common<true>::__throw_out_of_range() const + 76
  * frame #2: 0x0000000104d74250 Mapbox`std::__1::vector<std::__1::shared_ptr<mbgl::AnnotationTileFeatureData const>, std::__1::allocator<std::__1::shared_ptr<mbgl::AnnotationTileFeatureData const> > >::at(this=0x00000001d42922d0 size=1, __n=63) at vector:1513
    frame #3: 0x0000000104d73e8c Mapbox`mbgl::AnnotationTileLayer::getFeature(this=0x00000001d1431ce0, i=63) const at annotation_tile.cpp:83
    frame #4: 0x0000000104d8d0f4 Mapbox`mbgl::FeatureIndex::addFeature(this=0x00000001d4145ac0, result=size=0, indexedFeature=0x00000001d03922e0, queryGeometry=0x000000016bc895a0, options=0x000000016bc8c770, geometryTileData=0x00000001d5849a20, tileID=0x000000016bc8925c, layers=size=1, bearing=0, pixelsToTileUnits=10.3364401) const at feature_index.cpp:119
    frame #5: 0x0000000104d8ca30 Mapbox`mbgl::FeatureIndex::query(this=0x00000001d4145ac0, result=size=0, queryGeometry=0x000000016bc895a0, bearing=0, tileSize=512, scale=1.5479217236941738, queryOptions=0x000000016bc8c770, geometryTileData=0x00000001d5849a20, tileID=0x000000016bc89258, sourceID="com.mapbox.annotations", layers=size=1, collisionIndex=0x000000012612b730, additionalQueryRadius=0) const at feature_index.cpp:81
    frame #6: 0x00000001053136ec Mapbox`mbgl::GeometryTile::queryRenderedFeatures(this=0x000000012e8963f0, result=size=0, queryGeometry=0x000000016bc895a0, transformState=0x0000000112816a80, layers=size=1, options=0x000000016bc8c770, collisionIndex=0x000000012612b730) at geometry_tile.cpp:235
    frame #7: 0x0000000105026c78 Mapbox`mbgl::TilePyramid::queryRenderedFeatures(this=0x00000001d0123868, geometry=0x000000016bc8c068, transformState=0x0000000112816a80, layers=size=1, options=0x000000016bc8c770, collisionIndex=0x000000012612b730) const at tile_pyramid.cpp:283
    frame #8: 0x0000000104d81cb0 Mapbox`mbgl::RenderAnnotationSource::queryRenderedFeatures(this=0x00000001d0123840, geometry=0x000000016bc8c068, transformState=0x0000000112816a80, layers=size=1, options=0x000000016bc8c770, collisionIndex=0x000000012612b730) const at render_annotation_source.cpp:69
    frame #9: 0x0000000104fb4f38 Mapbox`mbgl::Renderer::Impl::queryRenderedFeatures(this=0x0000000112816a00, geometry=0x000000016bc8c068, options=0x000000016bc8c770, layers=size=1) const at renderer_impl.cpp:670
    frame #10: 0x0000000104fb35e4 Mapbox`mbgl::Renderer::Impl::queryRenderedFeatures(this=0x0000000112816a00, geometry=0x000000016bc8c068, options=0x000000016bc8c770) const at renderer_impl.cpp:658
    frame #11: 0x0000000104f9dae8 Mapbox`mbgl::Renderer::queryRenderedFeatures(this=0x00000001cc0167f0, box=0x000000016bc8c8f8, options=0x000000016bc8c770) const at renderer.cpp:45
    frame #12: 0x0000000104f9e24c Mapbox`mbgl::Renderer::queryPointAnnotations(this=0x00000001cc0167f0, box=0x000000016bc8c8f8) const at renderer.cpp:60
    frame #13: 0x0000000104c04034 Mapbox`::-[MGLMapView annotationTagsInRect:](self=0x000000011002ea00, _cmd="annotationTagsInRect:", rect=(origin = (x = 0, y = 0), size = (width = 375, height = 778))) at MGLMapView.mm:4200
    frame #14: 0x0000000104bfb968 Mapbox`::-[MGLMapView visibleAnnotationsInRect:](self=0x000000011002ea00, _cmd="visibleAnnotationsInRect:", rect=(origin = (x = 0, y = 0), size = (width = 375, height = 778))) at MGLMapView.mm:3547
    frame #15: 0x0000000104bfb8a4 Mapbox`::-[MGLMapView visibleAnnotations](self=0x000000011002ea00, _cmd="visibleAnnotations") at MGLMapView.mm:3537
    frame #16: 0x0000000104193804 Mapbox GL`-[MBXViewController updateHUD](self=0x000000010e60c7d0, _cmd="updateHUD") at MBXViewController.m:1966
    frame #17: 0x0000000104193398 Mapbox GL`-[MBXViewController mapViewRegionIsChanging:](self=0x000000010e60c7d0, _cmd="mapViewRegionIsChanging:", mapView=0x000000011002ea00) at MBXViewController.m:1943
    frame #18: 0x0000000104c11028 Mapbox`::-[MGLMapView cameraIsChanging](self=0x000000011002ea00, _cmd="cameraIsChanging") at MGLMapView.mm:5410
    frame #19: 0x0000000104c19100 Mapbox`MBGLView::onCameraIsChanging(this=0x00000001c005cb90) at MGLMapView.mm:6020
    frame #20: 0x0000000104c19c9c Mapbox`non-virtual thunk to MBGLView::onCameraIsChanging(this=0x00000001c005cb90) at MGLMapView.mm:0
    frame #21: 0x0000000104e19094 Mapbox`mbgl::Transform::startTransition(this=0x00000001248f2ee8, now=mbgl::TimePoint @ 0x000000016bc8d240)>, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > const&)::$_3::operator()(std::__1::chrono::time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >) const at transform.cpp:596
    frame #22: 0x0000000104e18b68 Mapbox`void std::__1::__invoke_void_return_wrapper<void>::__call<mbgl::Transform::startTransition(mbgl::CameraOptions const&, mbgl::AnimationOptions const&, std::__1::function<void (double)>, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > const&)::$_3&, std::__1::chrono::time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > > >(mbgl::Transform::startTransition(mbgl::CameraOptions const&, mbgl::AnimationOptions const&, std::__1::function<void (double)>, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > const&)::$_3&&&, std::__1::chrono::time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >&&) [inlined] decltype(__f=0x00000001248f2ee8, __args=0x000000016bc8d640)>, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > const&)::$_3&>(fp)(std::__1::forward<std::__1::chrono::time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > > >(fp0))) std::__1::__invoke<mbgl::Transform::startTransition(mbgl::CameraOptions const&, mbgl::AnimationOptions const&, std::__1::function<void (double)>, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > const&)::$_3&, std::__1::chrono::time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > > >(mbgl::Transform::startTransition(mbgl::CameraOptions const&, mbgl::AnimationOptions const&, std::__1::function<void (double)>, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > const&)::$_3&&&, std::__1::chrono::time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >&&) at type_traits:4291
    frame #23: 0x0000000104e18b40 Mapbox`void std::__1::__invoke_void_return_wrapper<void>::__call<mbgl::Transform::startTransition(__args=0x00000001248f2ee8, __args=0x000000016bc8d640)>, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > const&)::$_3&, std::__1::chrono::time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > > >(mbgl::Transform::startTransition(mbgl::CameraOptions const&, mbgl::AnimationOptions const&, std::__1::function<void (double)>, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > const&)::$_3&&&, std::__1::chrono::time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >&&) at __functional_base:359
    frame #24: 0x0000000104e18728 Mapbox`std::__1::__function::__func<mbgl::Transform::startTransition(mbgl::CameraOptions const&, mbgl::AnimationOptions const&, std::__1::function<void (double)>, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > const&)::$_3, std::__1::allocator<mbgl::Transform::startTransition(mbgl::CameraOptions const&, mbgl::AnimationOptions const&, std::__1::function<void (double)>, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > const&)::$_3>, void (std::__1::chrono::time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >)>::operator(this=0x00000001248f2ee0, __arg=0x000000016bc8d640)(std::__1::chrono::time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >&&) at functional:1552
    frame #25: 0x0000000104e13b20 Mapbox`std::__1::function<void (std::__1::chrono::time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >)>::operator(this=0x00000001248f2ee0, __arg=time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1, 1000000000> > > @ 0x000000016bc8d640)(std::__1::chrono::time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >) const at functional:1903
    frame #26: 0x0000000104e13bb8 Mapbox`mbgl::Transform::updateTransitions(this=0x0000000112302af8, now=0x000000016bc8d8f0) at transform.cpp:628
    frame #27: 0x0000000104e0d25c Mapbox`mbgl::Map::Impl::onUpdate(this=0x0000000112302ac0) at map.cpp:753
    frame #28: 0x0000000104e0d158 Mapbox`mbgl::Map::Impl::onInvalidate(this=0x0000000112302ac0) at map.cpp:747
    frame #29: 0x0000000104e0d180 Mapbox`non-virtual thunk to mbgl::Map::Impl::onInvalidate(this=0x0000000112302ac0) at map.cpp:0
    frame #30: 0x0000000104fb769c Mapbox`mbgl::Renderer::Impl::onTileChanged(this=0x0000000112816a00, (null)=0x00000001d0123840, (null)=0x000000012e8963f8) at renderer_impl.cpp:812
    frame #31: 0x0000000104fb76d4 Mapbox`non-virtual thunk to mbgl::Renderer::Impl::onTileChanged(this=0x0000000112816a00, (null)=0x00000001d0123840, (null)=0x000000012e8963f8) at renderer_impl.cpp:0
    frame #32: 0x0000000104f85fdc Mapbox`mbgl::RenderSource::onTileChanged(this=0x00000001d0123840, tile=0x000000012e8963f0) at render_source.cpp:52
    frame #33: 0x0000000105311c90 Mapbox`mbgl::GeometryTile::onLayout(this=0x000000012e8963f0, result=LayoutResult @ 0x000000016bc8dee8, resultCorrelationID=4) at geometry_tile.cpp:135
    frame #34: 0x00000001053cd5a4 Mapbox`void mbgl::MessageImpl<mbgl::GeometryTile, void (mbgl::GeometryTile::*)(mbgl::GeometryTile::LayoutResult, unsigned long long), std::__1::tuple<mbgl::GeometryTile::LayoutResult, unsigned long long> >::invoke<0ul, 1ul>(this=0x00000001d46b72e0, (null)=std::__1::index_sequence<0UL, 1UL> @ 0x000000016bc8df28) at message.hpp:34
    frame #35: 0x00000001053cd45c Mapbox`mbgl::MessageImpl<mbgl::GeometryTile, void (mbgl::GeometryTile::*)(mbgl::GeometryTile::LayoutResult, unsigned long long), std::__1::tuple<mbgl::GeometryTile::LayoutResult, unsigned long long> >::operator(this=0x00000001d46b72e0)() at message.hpp:29
    frame #36: 0x0000000104d23d74 Mapbox`mbgl::Mailbox::receive(this=0x000000012e898ab8) at mailbox.cpp:58
    frame #37: 0x0000000104d24088 Mapbox`mbgl::Mailbox::maybeReceive(mailbox=<unavailable>) at mailbox.cpp:67
    frame #38: 0x0000000105443b84 Mapbox`mbgl::util::RunLoop::schedule(this=0x00000001d4301db0)::'lambda'()::operator()() const at run_loop.hpp:68
    frame #39: 0x0000000105443b08 Mapbox`void mbgl::WorkTaskImpl<mbgl::util::RunLoop::schedule(std::__1::weak_ptr<mbgl::Mailbox>)::'lambda'(), std::__1::tuple<> >::invoke<>(this=0x00000001d4301d58, (null)=std::__1::index_sequence<> @ 0x000000016bc8e4d8) at work_task_impl.hpp:43
    frame #40: 0x00000001054438e0 Mapbox`mbgl::WorkTaskImpl<mbgl::util::RunLoop::schedule(std::__1::weak_ptr<mbgl::Mailbox>)::'lambda'(), std::__1::tuple<> >::operator(this=0x00000001d4301d58)() at work_task_impl.hpp:23
    frame #41: 0x0000000105440268 Mapbox`mbgl::util::RunLoop::process(this=0x0000000105631d98) at run_loop.hpp:91
    frame #42: 0x0000000105445268 Mapbox`void std::__1::__invoke_void_return_wrapper<void>::__call<std::__1::__bind<void (mbgl::util::RunLoop::*)(), mbgl::util::RunLoop*>&>(std::__1::__bind<void (mbgl::util::RunLoop::*)(), mbgl::util::RunLoop*>&&&) [inlined] decltype(__f=0x00000001c00301e8, __a0=0x00000001c00301f8)).*fp(std::__1::forward<>(fp1))) std::__1::__invoke<void (mbgl::util::RunLoop::*&)(), mbgl::util::RunLoop*&, void>(void (mbgl::util::RunLoop::*&&&)(), mbgl::util::RunLoop*&&&) at type_traits:4232
    frame #43: 0x00000001054451f8 Mapbox`void std::__1::__invoke_void_return_wrapper<void>::__call<std::__1::__bind<void (mbgl::util::RunLoop::*)(), mbgl::util::RunLoop*>&>(std::__1::__bind<void (mbgl::util::RunLoop::*)(), mbgl::util::RunLoop*>&&&) [inlined] std::__1::__bind_return<void (mbgl::util::RunLoop::*)(), std::__1::tuple<mbgl::util::RunLoop*>, std::__1::tuple<>, __is_valid_bind_return<void (mbgl::util::RunLoop::*)(), std::__1::tuple<mbgl::util::RunLoop*>, std::__1::tuple<> >::value>::type std::__1::__apply_functor<void (__f=0x00000001c00301e8, __bound_args=0x00000001c00301f8, __args=0x000000016bc8e7f0)(), std::__1::tuple<mbgl::util::RunLoop*>, 0ul, std::__1::tuple<> >(void (mbgl::util::RunLoop::*&)(), std::__1::tuple<mbgl::util::RunLoop*>&, std::__1::__tuple_indices<0ul>, std::__1::tuple<>&&) at functional:2206
    frame #44: 0x00000001054451c8 Mapbox`void std::__1::__invoke_void_return_wrapper<void>::__call<std::__1::__bind<void (mbgl::util::RunLoop::*)(), mbgl::util::RunLoop*>&>(std::__1::__bind<void (mbgl::util::RunLoop::*)(), mbgl::util::RunLoop*>&&&) [inlined] std::__1::__bind_return<void (mbgl::util::RunLoop::*)(), std::__1::tuple<mbgl::util::RunLoop*>, std::__1::tuple<>, __is_valid_bind_return<void (mbgl::util::RunLoop::*)(), std::__1::tuple<mbgl::util::RunLoop*>, std::__1::tuple<> >::value>::type std::__1::__bind<void (this=0x00000001c00301e8)(), mbgl::util::RunLoop*>::operator()<>() at functional:2239
    frame #45: 0x00000001054451a8 Mapbox`void std::__1::__invoke_void_return_wrapper<void>::__call<std::__1::__bind<void (mbgl::util::RunLoop::*)(), mbgl::util::RunLoop*>&>(std::__1::__bind<void (mbgl::util::RunLoop::*)(), mbgl::util::RunLoop*>&&&) [inlined] decltype(__f=0x00000001c00301e8)(), mbgl::util::RunLoop*>&>(fp)(std::__1::forward<>(fp0))) std::__1::__invoke<std::__1::__bind<void (mbgl::util::RunLoop::*)(), mbgl::util::RunLoop*>&>(std::__1::__bind<void (mbgl::util::RunLoop::*)(), mbgl::util::RunLoop*>&&&) at type_traits:4291
    frame #46: 0x0000000105445194 Mapbox`void std::__1::__invoke_void_return_wrapper<void>::__call<std::__1::__bind<void (__args=0x00000001c00301e8)(), mbgl::util::RunLoop*>&>(std::__1::__bind<void (mbgl::util::RunLoop::*)(), mbgl::util::RunLoop*>&&&) at __functional_base:359
    frame #47: 0x0000000105445024 Mapbox`std::__1::__function::__func<std::__1::__bind<void (mbgl::util::RunLoop::*)(), mbgl::util::RunLoop*>, std::__1::allocator<std::__1::__bind<void (mbgl::util::RunLoop::*)(), mbgl::util::RunLoop*> >, void ()>::operator(this=0x00000001c00301e0)() at functional:1552
    frame #48: 0x0000000105442678 Mapbox`std::__1::function<void ()>::operator(this=0x00000001c00301e0)() const at functional:1903
    frame #49: 0x000000010543f678 Mapbox`mbgl::util::AsyncTask::Impl::runTask(this=0x00000001c026a980) at async_task.cpp:45
    frame #50: 0x000000010543f500 Mapbox`mbgl::util::AsyncTask::Impl::perform(info=0x00000001c026a980) at async_task.cpp:50
    frame #51: 0x0000000185f7e97c CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
    frame #52: 0x0000000185f7e8fc CoreFoundation`__CFRunLoopDoSource0 + 88
    frame #53: 0x0000000185f7e184 CoreFoundation`__CFRunLoopDoSources0 + 204
    frame #54: 0x0000000185f7bd5c CoreFoundation`__CFRunLoopRun + 1048
    frame #55: 0x0000000185e9be58 CoreFoundation`CFRunLoopRunSpecific + 436
    frame #56: 0x0000000187d48f84 GraphicsServices`GSEventRunModal + 100
    frame #57: 0x000000018f51b67c UIKit`UIApplicationMain + 236
    frame #58: 0x00000001041778b8 Mapbox GL`main(argc=1, argv=0x000000016bc8f890) at main.m:8
    frame #59: 0x00000001859b856c libdyld.dylib`start + 4

/cc @fabian-guerra @akitchen @boundsj @1ec5

Activity

  1. added
    iOS
    annotations
    Core
    on Jan 5, 2018
  2. 1ec5 commented on Jan 9, 2018

    @1ec5
    Contributor

    Does this issue reproduce in v3.7.x?

  3. friedbunny commented on Jan 10, 2018

    @friedbunny
    ContributorAuthor

    Does this issue reproduce in v3.7.x?

    No, it does not — this is a regression since v3.7.x, which makes me think this is related to #10845.

    /cc @ChrisLoer

  4. added this to the milestone on Jan 10, 2018
  5. ChrisLoer commented on Jan 10, 2018

    @ChrisLoer
    Contributor

    This sounds related to, or possibly just the same as, #10778 -- visibleAnnotations depends on queryRenderedSymbols, and we know that can break in-between placements. We haven't figured out how we're going to fix that issue yet, but it's next up for me and @ansis.

  6. ChrisLoer commented on Jan 12, 2018

    @ChrisLoer
    Contributor

    This problem doesn't turn out to be #10778. I don't think there's any problem that's particular to AnnotationTile, either. Here's (roughly) what happens when you tap "Add 100 Views" starting at zoom 0.

    • A z0 tile gets created with 100 markers. They all get assigned a crossTileID from 1-100 in the CrossTileSymbolIndex
    • The map zooms in to z9 (which still shows all the markers), and creates a z9 tile. They're added to the CrossTileSymbolIndex while the z0 tile hasn't been removed yet. From the point of view of getScaledCoordinates, they're all duplicates with every one of the items in the z0 tile (basically, they all fit within 1 pixel on the z0 view). The logic assigns them the crossTileID of the first duplicate they find, so they all get a crossTileID of 1.
    • The z0 tile is removed, but the damage is done, all the symbol instances have been given the same crossTileID.
    • You can zoom into z10, causing the CrossTileSymbolIndex to update, and this time it will be able to accurately match the 100 markers between z9 and z10, but it doesn't matter, because all of the z9 markers already share the same crossTileID, and so that'll just get copied over to z10.

    Once the CrossTileSymbolIndex is messed up, you'll start seeing problems like markers not rendering or not showing up in a queryRenderedSymbols call. It feels kind of silly here because all of these markers are ignore-placement/allow-overlap, but we still need to include them in the CrossTileSymbolIndex in order to be able to handle fade-in animations.

    I'm not sure about the solution, but I think it's actually OK that all the z9 markers are marked duplicate against a single z0 marker in the first step -- from the point of view of the z0 tile, all those markers are in the exact same place, and the z0 tile is still showing, so we need the z9 markers to be marked duplicate against something (otherwise both the z0 and the z9 version of the marker would end up being returned from symbol queries). Once the z0 tile is removed, however, we need to recover.

    I think the invariant we want to maintain is something like "if a tile in the index has no parents, then every crossTileID in it should be unique". Unfortunately, maintaining that invariant will probably reintroduce some of the tricky bookkeeping we got rid of when we switched to using crossTileID.

  7. ChrisLoer commented on Jan 17, 2018

    @ChrisLoer
    Contributor

    Fixed in #10936, with two caveats:

    1. I never reproduced the crash bug, but I believe it to be caused by 'queryRenderedSymbols' results invalid between tile reload and next rendered frame  #10778.
    2. In the 10,000 view case, the "visible" count still came in short at 9,089, but I'm pretty sure whatever's causing that has a different root cause (and the count is the same as what we'd see before all of the recent changes to CrossTileSymbolIndex).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CoreannotationsbugiOS

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions