iOS 13 crash on MapKit at -[MKTileOverlayRenderer canDrawMapRect:zoomScale:]

Seeing 2 crashes in our app on iOS 13 mapkit:


#1


Crashed: com.apple.mapdisplay.dispatch.overlaytiledecodequeue

0 libobjc.A.dylib 0x19e700050 objc_msgSend + 16

1 MapKit 0x1ac394fb4 <redacted> + 472

2 (Missing) 0x7915f081ac550c00 (Missing)

3 (Missing) 0x705b381ac550b80 (Missing)

4 (Missing) 0x0 (Missing)

5 (Missing) 0x0 (Missing)

6 (Missing) 0x47683801acf6b800 (Missing)

7 (Missing) 0x0 (Missing)

8 (Missing) 0x5f16f801ad19cc00 (Missing)

9 (Missing) 0x497b4c01ad1a0800 (Missing)

10 (Missing) 0x343ff301ad11ee00 (Missing)

11 (Missing) 0x1373bb819e68fc00 (Missing)

12 (Missing) 0x444ae9019e691000 (Missing)

13 (Missing) 0x2979d7819e697400 (Missing)

14 (Missing) 0x10480e819e697f00 (Missing)

15 (Missing) 0x0 (Missing)

16 (Missing) 0x703f38819e6f6c00 (Missing)

17 (Missing) 0x447608019e6fcc00 (Missing)



#2


Crashed: com.apple.mapdisplay.dispatch.overlaytiledecodequeue
0  libobjc.A.dylib                0x1848e81a0 objc_msgSend + 32
1  MapKit                         0x1921711e0 -[MKTileOverlayRenderer canDrawMapRect:zoomScale:] + 428
2  MapKit                         0x19231d8ec __40-[MKOverlayRenderer overlay:canDrawKey:]_block_invoke + 256
3  MapKit                         0x19231d7a0 __68-[MKOverlayRenderer _forEachMapRectForKey:withContext:performBlock:]_block_invoke + 496
4  MapKit                         0x19231d548 -[MKOverlayRenderer _forEachMapRectForKey:withContext:performBlock:] + 200
5  MapKit                         0x192168d60 -[MKOverlayRenderer overlay:canDrawKey:] + 168
6  VectorKit                      0x192d25378 _processOverlays(geo::MercatorTile const&, unsigned int, float, VKSharedResources const*, ggl::Loader&, std::__1::vector<geo::_retain_ptr<VKOverlay*, geo::_retain_objc, geo::_release_objc, geo::_hash_objc, geo::_equal_objc>, std::__1::allocator<geo::_retain_ptr<VKOverlay*, geo::_retain_objc, geo::_release_objc, geo::_hash_objc, geo::_equal_objc> > > const&, std::__1::vector<md::OverlayTileData::OverlayTileResource, std::__1::allocator<md::OverlayTileData::OverlayTileResource> >&, std::__1::shared_ptr<ggl::ConstantDataTyped<ggl::Tile::View> >) + 520
7  VectorKit                      0x192d24f94 md::OverlayLayerDataSource::createLayerData(mdc::LayerDataRequestKey const&, geo::linear_map<unsigned short, std::__1::unordered_map<mdc::ResourceKey, std::__1::shared_ptr<mdc::Resource>, mdc::ResourceKeyHash, std::__1::equal_to<mdc::ResourceKey>, std::__1::allocator<std::__1::pair<mdc::ResourceKey const, std::__1::shared_ptr<mdc::Resource> > > >, std::__1::equal_to<unsigned short>, std::__1::allocator<std::__1::pair<unsigned short, std::__1::unordered_map<mdc::ResourceKey, std::__1::shared_ptr<mdc::Resource>, mdc::ResourceKeyHash, std::__1::equal_to<mdc::ResourceKey>, std::__1::allocator<std::__1::pair<mdc::ResourceKey const, std::__1::shared_ptr<mdc::Resource> > > > > >, std::__1::vector<std::__1::pair<unsigned short, std::__1::unordered_map<mdc::ResourceKey, std::__1::shared_ptr<mdc::Resource>, mdc::ResourceKeyHash, std::__1::equal_to<mdc::ResourceKey>, std::__1::allocator<std::__1::pair<mdc::ResourceKey const, std::__1::shared_ptr<mdc::Resource> > > > >, std::__1::allocator<std::__1::pair<unsigned short, std::__1::unordered_map<mdc::ResourceKey, std::__1::shared_ptr<mdc::Resource>, mdc::ResourceKeyHash, std::__1::equal_to<mdc::ResourceKey>, std::__1::allocator<std::__1::pair<mdc::ResourceKey const, std::__1::shared_ptr<mdc::Resource> > > > > > > > const&, long long) const + 372
8  VectorKit                      0x192f59944 mdc::LayerDataSource::updateLayerData(unsigned long, mdc::LayerDataRequestKey const&, geo::linear_map<unsigned short, std::__1::unordered_map<mdc::ResourceKey, std::__1::shared_ptr<mdc::Resource>, mdc::ResourceKeyHash, std::__1::equal_to<mdc::ResourceKey>, std::__1::allocator<std::__1::pair<mdc::ResourceKey const, std::__1::shared_ptr<mdc::Resource> > > >, std::__1::equal_to<unsigned short>, std::__1::allocator<std::__1::pair<unsigned short, std::__1::unordered_map<mdc::ResourceKey, std::__1::shared_ptr<mdc::Resource>, mdc::ResourceKeyHash, std::__1::equal_to<mdc::ResourceKey>, std::__1::allocator<std::__1::pair<mdc::ResourceKey const, std::__1::shared_ptr<mdc::Resource> > > > > >, std::__1::vector<std::__1::pair<unsigned short, std::__1::unordered_map<mdc::ResourceKey, std::__1::shared_ptr<mdc::Resource>, mdc::ResourceKeyHash, std::__1::equal_to<mdc::ResourceKey>, std::__1::allocator<std::__1::pair<mdc::ResourceKey const, std::__1::shared_ptr<mdc::Resource> > > > >, std::__1::allocator<std::__1::pair<unsigned short, std::__1::unordered_map<mdc::ResourceKey, std::__1::shared_ptr<mdc::Resource>, mdc::ResourceKeyHash, std::__1::equal_to<mdc::ResourceKey>, std::__1::allocator<std::__1::pair<mdc::ResourceKey const, std::__1::shared_ptr<mdc::Resource> > > > > > > > const&, long long) + 92
9  VectorKit                      0x192f5d524 std::__1::__function::__func<mdc::LayerDataSource::processLayerDataRequests(mdc::ResourceManager*, geo::TaskGroup*, long long)::$_5, std::__1::allocator<mdc::LayerDataSource::processLayerDataRequests(mdc::ResourceManager*, geo::TaskGroup*, long long)::$_5>, void ()>::operator()() + 156
10 VectorKit                      0x192edd0ac invocation function for block in geo::TaskQueue::queueAsyncTask(std::__1::shared_ptr<geo::Task>, NSObject<OS_dispatch_group>*) + 80
11 libdispatch.dylib              0x184890658 _dispatch_call_block_and_release + 24
12 libdispatch.dylib              0x1848911cc _dispatch_client_callout + 16
13 libdispatch.dylib              0x18483d524 _dispatch_lane_serial_drain$VARIANT$mp + 608
14 libdispatch.dylib              0x18483df48 _dispatch_lane_invoke$VARIANT$mp + 468
15 libdispatch.dylib              0x184847400 _dispatch_workloop_worker_thread + 588
16 libsystem_pthread.dylib        0x1848e0fa8 _pthread_wqthread + 276
17 libsystem_pthread.dylib        0x1848e3ae4 start_wqthread + 8

Replies

Yes, I am seeing a similar issue:


#1. Crashed: com.apple.mapdisplay.dispatch.overlaytiledecodequeue
0  libsystem_kernel.dylib         0x194296928 __abort_with_payload + 8
1  libsystem_kernel.dylib         0x19429af1c abort_with_payload_wrapper_internal + 100
2  libsystem_kernel.dylib         0x19429aeb8 abort_with_payload_wrapper_internal + 26
3  libobjc.A.dylib                0x1941e4254 _objc_fatalv(unsigned long long, unsigned long long, char const*, char*) + 104
4  libobjc.A.dylib                0x1941e41ec _objc_fatalv(unsigned long long, unsigned long long, char const*, char*) + 26
5  libobjc.A.dylib                0x1941d6494 lookUpImpOrForward + 684
6  libobjc.A.dylib                0x1941c44fc _objc_msgSend_uncached + 60
7  MapKit                         0x1a1bf9890 __40-[MKOverlayRenderer overlay:canDrawKey:]_block_invoke + 164
8  MapKit                         0x1a1bf9548 -[MKOverlayRenderer _forEachMapRectForKey:withContext:performBlock:] + 200
9  MapKit                         0x1a1a44d60 -[MKOverlayRenderer overlay:canDrawKey:] + 168
10 VectorKit                      0x1a2601c0c _processOverlays(geo::MercatorTile const&, unsigned int, float, VKSharedResources const*, ggl::Loader&, std::__1::vector<geo::_retain_ptr<VKOverlay*, geo::_retain_objc, geo::_release_objc, geo::_hash_objc, geo::_equal_objc>, std::__1::allocator<geo::_retain_ptr<VKOverlay*, geo::_retain_objc, geo::_release_objc, geo::_hash_objc, geo::_equal_objc> > > const&, std::__1::vector<md::OverlayTileData::OverlayTileResource, std::__1::allocator<md::OverlayTileData::OverlayTileResource> >&, std::__1::shared_ptr<ggl::ConstantDataTyped<ggl::Tile::View> >) + 2716
11 VectorKit                      0x1a2600f94 md::OverlayLayerDataSource::createLayerData(mdc::LayerDataRequestKey const&, geo::linear_map<unsigned short, std::__1::unordered_map<mdc::ResourceKey, std::__1::shared_ptr<mdc::Resource>, mdc::ResourceKeyHash, std::__1::equal_to<mdc::ResourceKey>, std::__1::allocator<std::__1::pair<mdc::ResourceKey const, std::__1::shared_ptr<mdc::Resource> > > >, std::__1::equal_to<unsigned short>, std::__1::allocator<std::__1::pair<unsigned short, std::__1::unordered_map<mdc::ResourceKey, std::__1::shared_ptr<mdc::Resource>, mdc::ResourceKeyHash, std::__1::equal_to<mdc::ResourceKey>, std::__1::allocator<std::__1::pair<mdc::ResourceKey const, std::__1::shared_ptr<mdc::Resource> > > > > >, std::__1::vector<std::__1::pair<unsigned short, std::__1::unordered_map<mdc::ResourceKey, std::__1::shared_ptr<mdc::Resource>, mdc::ResourceKeyHash, std::__1::equal_to<mdc::ResourceKey>, std::__1::allocator<std::__1::pair<mdc::ResourceKey const, std::__1::shared_ptr<mdc::Resource> > > > >, std::__1::allocator<std::__1::pair<unsigned short, std::__1::unordered_map<mdc::ResourceKey, std::__1::shared_ptr<mdc::Resource>, mdc::ResourceKeyHash, std::__1::equal_to<mdc::ResourceKey>, std::__1::allocator<std::__1::pair<mdc::ResourceKey const, std::__1::shared_ptr<mdc::Resource> > > > > > > > const&, long long) const + 372
12 VectorKit                      0x1a2835944 mdc::LayerDataSource::updateLayerData(unsigned long, mdc::LayerDataRequestKey const&, geo::linear_map<unsigned short, std::__1::unordered_map<mdc::ResourceKey, std::__1::shared_ptr<mdc::Resource>, mdc::ResourceKeyHash, std::__1::equal_to<mdc::ResourceKey>, std::__1::allocator<std::__1::pair<mdc::ResourceKey const, std::__1::shared_ptr<mdc::Resource> > > >, std::__1::equal_to<unsigned short>, std::__1::allocator<std::__1::pair<unsigned short, std::__1::unordered_map<mdc::ResourceKey, std::__1::shared_ptr<mdc::Resource>, mdc::ResourceKeyHash, std::__1::equal_to<mdc::ResourceKey>, std::__1::allocator<std::__1::pair<mdc::ResourceKey const, std::__1::shared_ptr<mdc::Resource> > > > > >, std::__1::vector<std::__1::pair<unsigned short, std::__1::unordered_map<mdc::ResourceKey, std::__1::shared_ptr<mdc::Resource>, mdc::ResourceKeyHash, std::__1::equal_to<mdc::ResourceKey>, std::__1::allocator<std::__1::pair<mdc::ResourceKey const, std::__1::shared_ptr<mdc::Resource> > > > >, std::__1::allocator<std::__1::pair<unsigned short, std::__1::unordered_map<mdc::ResourceKey, std::__1::shared_ptr<mdc::Resource>, mdc::ResourceKeyHash, std::__1::equal_to<mdc::ResourceKey>, std::__1::allocator<std::__1::pair<mdc::ResourceKey const, std::__1::shared_ptr<mdc::Resource> > > > > > > > const&, long long) + 92
13 VectorKit                      0x1a2839524 std::__1::__function::__func<mdc::LayerDataSource::processLayerDataRequests(mdc::ResourceManager*, geo::TaskGroup*, long long)::$_5, std::__1::allocator<mdc::LayerDataSource::processLayerDataRequests(mdc::ResourceManager*, geo::TaskGroup*, long long)::$_5>, void ()>::operator()() + 156
14 VectorKit                      0x1a27b90ac invocation function for block in geo::TaskQueue::queueAsyncTask(std::__1::shared_ptr<geo::Task>, NSObject<OS_dispatch_group>*) + 80
15 libdispatch.dylib              0x19416c658 _dispatch_call_block_and_release + 24
16 libdispatch.dylib              0x19416d1cc _dispatch_client_callout + 16
17 libdispatch.dylib              0x194119524 _dispatch_lane_serial_drain$VARIANT$mp + 608
18 libdispatch.dylib              0x194119f48 _dispatch_lane_invoke$VARIANT$mp + 468
19 libdispatch.dylib              0x194123400 _dispatch_workloop_worker_thread + 588
20 libsystem_pthread.dylib        0x1941bcfa8 _pthread_wqthread + 276
21 libsystem_pthread.dylib        0x1941bfae4 start_wqthread + 8


Anybody with any idea?

I am not able to recreate the crash in-house, @totalidea are you able to recreate the crash on your maps?


I just removed the overlays in view will disappear & dealloc. Hopefully that will avoid the crash.


Can someone from Apple team shed more light on how to debug these crashes, esp. when we can't recreate the issue, @KevinE ?

@AmitWB


No, I was never able to reproduce the crash. Whatever I do here, everything works just fine. I suspect that the problem only occurs on devices of the new 2019 series (iPhone or iPad), because Crashlytics will only display 'Apple' as device types, possibly because the new iPhone and iPad models are not yet recognized by Crashlytics. ,

@AmitWB


Maybe this is a threading issue? What do you think about moving addoverlay and removeoverlay to the main thread? addoverlay is running on the main thread in my project, but removeoverlay is not. I'll change that and see if that makes a difference.

viewwilldisappear & dealloc where removeoverlay is, r both called on main Q


adding overlay asyn, may help


dispatch_async(dispatch_get_main_queue(), ^{

I am adding the overlay async, so this is not the cause for the crash. What I know so far is that the issue is pretty rare and seems to affect a few, maybe some specific devices, only. I guess it's an issue of the new 2019 devices, but I am not sure.

The issue does seem rare and we haven't been able to reproduce it, but our users are seeing it for sure. At this point it looks like a bug in Apple's code, so what we have done to minimize the issue it is to reduce the amount of times the map is refreshed (removing/adding overlays). We don't know if this will help, but we don't have much more to go on.


Have you investigated this issue further?

Yes, it seems to be related to the amount of times you add overlays, or the interval betwen adding overlays.


We were using a UISlider to draw a circle on the map with a radius set by the slider, and a valueChange event of the slider actually started drawing the circle on the map. We have now set a 0.5 second delay between every valueChange event, so that MapKit has enough time to complete drwaing the overlay before a new overlay is drawn.


That seems to work - we have not seen any further issues so far.

I reported some iOS 13 specific crashes related to adding and removing overlays to Apple back in August and now all my reports are marked as:

Recent Similar Reports:Less than 10

Resolution:Potential fix identified - For a future OS update

I also reported on quite degraded performance on adding and removing overlays in iOS 13 MapKit and this is now marked by Apple with the same resolution, so hopefully this all will be fixed soon.

I unchecked traffic in my map view, this resolved the problem.