Crash during MetalView.draw method call
Thanks for all your hard work!
Environment
-
Xcode version: 15.3
-
iOS version: 17.5.1/17.4.1/17.4/17.3.1/17.3.0/17.2.1/16.7.7/16.6.1/16.3.1
-
Devices affected: iPhone/iPad/Simulator
-
Maps SDK Version: 10.17.0
Observed behavior and steps to reproduce
Just staying on the map, and sometimes this crash happens. I have updateGeoJSONSource and updateLayer called frequently to update the position and appearance of the layer.
Maybe you know what is wrong and can help me understand the cause.
Stack traces:
1
Crashed: com.apple.main-thread
0 MapboxCoreMaps 0x2b0ee0 mbgl::RenderSymbolLayer::render(mbgl::PaintParameters&) + 2500
1 MapboxCoreMaps 0x2e9cd8 mbgl::(anonymous namespace)::LayerRenderItemImpl::render(mbgl::PaintParameters&) const + 92
2 MapboxCoreMaps 0x303cd0 mbgl::Renderer::Impl::render(mbgl::RenderTree const&) + 28280
3 MapboxCoreMaps 0x2f86f0 mbgl::Renderer::render(std::__1::shared_ptr<mbgl::UpdateParameters> const&) + 604
4 MapboxCoreMaps 0x79130 mapbox::maps::MapImpl::Impl::render() + 400
5 MapboxCoreMaps 0x74270 -[MBMMetalViewDelegate drawInMTKView:] + 536
6 MetalKit 0x3224 -[MTKView draw] + 160
7 App 0xd3282c MapView.updateFromDisplayLink(displayLink:) + 631 (MapView.swift:631)
8 App 0xd33354 closure #1 in MapView.didMoveToWindow() + 667 (MapView.swift:667)
9 App 0xd1d93c ForwardingDisplayLinkTarget.update(with:) + 12 (ForwardingDispalyLinkTarget.swift:12)
10 App 0xd1d988 @objc ForwardingDisplayLinkTarget.update(with:) + 4347599240 (<compiler-generated>:4347599240)
11 QuartzCore 0x2fd50 CA::Display::DisplayLinkItem::dispatch_(CA::SignPost::Interval<(CA::SignPost::CAEventCode)835322056>&) + 48
12 QuartzCore 0x32f30 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 868
13 QuartzCore 0xb1654 CA::Display::DisplayLink::dispatch_deferred_display_links(unsigned int) + 352
14 UIKitCore 0xaad78 _UIUpdateSequenceRun + 84
15 UIKitCore 0xaa468 schedulerStepScheduledMainSection + 144
16 UIKitCore 0xaa524 runloopSourceCallback + 92
17 CoreFoundation 0x3762c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
18 CoreFoundation 0x368a8 __CFRunLoopDoSource0 + 176
19 CoreFoundation 0x35058 __CFRunLoopDoSources0 + 244
20 CoreFoundation 0x33d88 __CFRunLoopRun + 828
21 CoreFoundation 0x33968 CFRunLoopRunSpecific + 608
22 GraphicsServices 0x34e0 GSEventRunModal + 164
23 UIKitCore 0x22aedc -[UIApplication _run] + 888
24 UIKitCore 0x22a518 UIApplicationMain + 340
25 App 0x806c main + 24 (main.swift:24)
2
Crashed: com.apple.main-thread
0 MapboxCoreMaps 0x1adea0 mbgl::UpdateParameters::~UpdateParameters() + 236
1 MapboxCoreMaps 0x4eb32c mbgl::Placement::reset(std::__1::shared_ptr<mbgl::UpdateParameters const>, mbgl::Placement const*) + 96
2 MapboxCoreMaps 0x4f8c70 mbgl::PlacementController::updatePlacement(std::__1::shared_ptr<mbgl::UpdateParameters const>) + 120
3 MapboxCoreMaps 0x2e0b20 mbgl::RenderOrchestrator::createRenderTree(std::__1::shared_ptr<mbgl::UpdateParameters> const&) + 58852
4 MapboxCoreMaps 0x2f855c mbgl::Renderer::render(std::__1::shared_ptr<mbgl::UpdateParameters> const&) + 200
5 MapboxCoreMaps 0x79130 mapbox::maps::MapImpl::Impl::render() + 400
6 MapboxCoreMaps 0x74270 -[MBMMetalViewDelegate drawInMTKView:] + 536
7 MetalKit 0x3224 -[MTKView draw] + 160
8 App 0xd3282c MapView.updateFromDisplayLink(displayLink:) + 631 (MapView.swift:631)
9 App 0xd33354 closure #1 in MapView.didMoveToWindow() + 667 (MapView.swift:667)
10 App 0xd1d93c ForwardingDisplayLinkTarget.update(with:) + 12 (ForwardingDispalyLinkTarget.swift:12)
11 App 0xd1d988 @objc ForwardingDisplayLinkTarget.update(with:) + 4324645256 (<compiler-generated>:4324645256)
12 QuartzCore 0x2fd50 CA::Display::DisplayLinkItem::dispatch_(CA::SignPost::Interval<(CA::SignPost::CAEventCode)835322056>&) + 48
13 QuartzCore 0x32f30 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 868
14 QuartzCore 0xb1654 CA::Display::DisplayLink::dispatch_deferred_display_links(unsigned int) + 352
15 UIKitCore 0xaad78 _UIUpdateSequenceRun + 84
16 UIKitCore 0xaa468 schedulerStepScheduledMainSection + 144
17 UIKitCore 0xaa524 runloopSourceCallback + 92
18 CoreFoundation 0x3762c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
19 CoreFoundation 0x368a8 __CFRunLoopDoSource0 + 176
20 CoreFoundation 0x35058 __CFRunLoopDoSources0 + 244
21 CoreFoundation 0x33d88 __CFRunLoopRun + 828
22 CoreFoundation 0x33968 CFRunLoopRunSpecific + 608
23 GraphicsServices 0x34e0 GSEventRunModal + 164
24 UIKitCore 0x22aedc -[UIApplication _run] + 888
25 UIKitCore 0x22a518 UIApplicationMain + 340
26 App 0x806c main + 24 (main.swift:24)
3
Crashed: com.apple.main-thread
0 MapboxCoreMaps 0x3e2bd8 std::__1::__tree<std::__1::__value_type<unsigned char, unsigned int>, std::__1::__map_value_compare<unsigned char, std::__1::__value_type<unsigned char, unsigned int>, std::__1::less<unsigned char>, true>, std::__1::allocator<std::__1::__value_type<unsigned char, unsigned int>>>::destroy(std::__1::__tree_node<std::__1::__value_type<unsigned char, unsigned int>, void*>*) + 24
1 MapboxCoreMaps 0x3e2be0 std::__1::__tree<std::__1::__value_type<unsigned char, unsigned int>, std::__1::__map_value_compare<unsigned char, std::__1::__value_type<unsigned char, unsigned int>, std::__1::less<unsigned char>, true>, std::__1::allocator<std::__1::__value_type<unsigned char, unsigned int>>>::destroy(std::__1::__tree_node<std::__1::__value_type<unsigned char, unsigned int>, void*>*) + 32
2 MapboxCoreMaps 0x3e2be0 std::__1::__tree<std::__1::__value_type<unsigned char, unsigned int>, std::__1::__map_value_compare<unsigned char, std::__1::__value_type<unsigned char, unsigned int>, std::__1::less<unsigned char>, true>, std::__1::allocator<std::__1::__value_type<unsigned char, unsigned int>>>::destroy(std::__1::__tree_node<std::__1::__value_type<unsigned char, unsigned int>, void*>*) + 32
3 MapboxCoreMaps 0x3e2be0 std::__1::__tree<std::__1::__value_type<unsigned char, unsigned int>, std::__1::__map_value_compare<unsigned char, std::__1::__value_type<unsigned char, unsigned int>, std::__1::less<unsigned char>, true>, std::__1::allocator<std::__1::__value_type<unsigned char, unsigned int>>>::destroy(std::__1::__tree_node<std::__1::__value_type<unsigned char, unsigned int>, void*>*) + 32
4 MapboxCoreMaps 0x3e2bec std::__1::__tree<std::__1::__value_type<unsigned char, unsigned int>, std::__1::__map_value_compare<unsigned char, std::__1::__value_type<unsigned char, unsigned int>, std::__1::less<unsigned char>, true>, std::__1::allocator<std::__1::__value_type<unsigned char, unsigned int>>>::destroy(std::__1::__tree_node<std::__1::__value_type<unsigned char, unsigned int>, void*>*) + 44
5 MapboxCoreMaps 0x4b43a8 std::__1::__shared_ptr_pointer<mbgl::style::GeoJSONVTData*, std::__1::shared_ptr<mbgl::style::GeoJSONData>::__shared_ptr_default_delete<mbgl::style::GeoJSONData, mbgl::style::GeoJSONVTData>, std::__1::allocator<mbgl::style::GeoJSONVTData>>::__on_zero_shared() + 124
6 MapboxCoreMaps 0x4abd10 std::__1::__shared_ptr_emplace<mbgl::style::GeoJSONSource::Impl, std::__1::allocator<mbgl::style::GeoJSONSource::Impl>>::__on_zero_shared() + 124
7 MapboxCoreMaps 0x2d21c8 std::__1::__shared_ptr_emplace<std::__1::vector<mbgl::Immutable<mbgl::style::Source::Impl>, std::__1::allocator<mbgl::Immutable<mbgl::style::Source::Impl>>>, std::__1::allocator<std::__1::vector<mbgl::Immutable<mbgl::style::Source::Impl>, std::__1::allocator<mbgl::Immutable<mbgl::style::Source::Impl>>>>>::__on_zero_shared() + 108
8 MapboxCoreMaps 0x1ade90 mbgl::UpdateParameters::~UpdateParameters() + 220
9 MapboxCoreMaps 0x4eb32c mbgl::Placement::reset(std::__1::shared_ptr<mbgl::UpdateParameters const>, mbgl::Placement const*) + 96
10 MapboxCoreMaps 0x4f8c70 mbgl::PlacementController::updatePlacement(std::__1::shared_ptr<mbgl::UpdateParameters const>) + 120
11 MapboxCoreMaps 0x2e0b20 mbgl::RenderOrchestrator::createRenderTree(std::__1::shared_ptr<mbgl::UpdateParameters> const&) + 58852
12 MapboxCoreMaps 0x2f855c mbgl::Renderer::render(std::__1::shared_ptr<mbgl::UpdateParameters> const&) + 200
13 MapboxCoreMaps 0x79130 mapbox::maps::MapImpl::Impl::render() + 400
14 MapboxCoreMaps 0x74270 -[MBMMetalViewDelegate drawInMTKView:] + 536
15 MetalKit 0x74b4 -[MTKView draw] + 160
16 App 0xd3282c MapView.updateFromDisplayLink(displayLink:) + 631 (MapView.swift:631)
17 App 0xd33354 closure #1 in MapView.didMoveToWindow() + 667 (MapView.swift:667)
18 App 0xd1d93c ForwardingDisplayLinkTarget.update(with:) + 12 (ForwardingDispalyLinkTarget.swift:12)
19 App 0xd1d988 @objc ForwardingDisplayLinkTarget.update(with:) + 4316404104 (<compiler-generated>:4316404104)
20 QuartzCore 0xd0ecc CA::Display::DisplayLinkItem::dispatch_(CA::SignPost::Interval<(CA::SignPost::CAEventCode)835322056>&) + 48
21 QuartzCore 0xcf230 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 876
22 QuartzCore 0xcedd0 CA::Display::DisplayLink::dispatch_deferred_display_links(unsigned int) + 352
23 UIKitCore 0xb776c _UIUpdateSequenceRun + 84
24 UIKitCore 0xb73b0 schedulerStepScheduledMainSection + 172
25 UIKitCore 0xb8254 runloopSourceCallback + 92
26 CoreFoundation 0x56834 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
27 CoreFoundation 0x567c8 __CFRunLoopDoSource0 + 176
28 CoreFoundation 0x54298 __CFRunLoopDoSources0 + 244
29 CoreFoundation 0x53484 __CFRunLoopRun + 828
30 CoreFoundation 0x52cd8 CFRunLoopRunSpecific + 608
31 GraphicsServices 0x11a8 GSEventRunModal + 164
32 UIKitCore 0x40a90c -[UIApplication _run] + 888
33 UIKitCore 0x4be9d0 UIApplicationMain + 340
34 App 0x806c main + 24 (main.swift:24)
Expected behavior
No crash
@Bogdan-Belogurov Hard to say from the stack traces alone, could you put together a sample project exhibiting the crash? It would help a great deal if we could reproduce it on our end.
@evil159 Thanks for the reply 🙏🏿 It's hard to reproduce because I can't figure out the steps but I'll try 🤔
I've also been getting crashes coming from various places in MetalView.draw. Our project also updates geojson source frequently (in order to animate some symbol and model layers). Sometimes the app crashes, sometimes the app freezes without crashing. It's been hard to reproduce reliably for me, as it seems like whatever's causing these crashes is triggered somewhere upstream, but will try to isolate as well. One thing to note in our case, is that the crashes occur usually when we are animating the camera with a camera animator.
Here are a few of the stack traces from when the app was terminated when it became unresponsive.
Trace 1 in mbgl::metal::UploadPass::updateTextureRegion
App Hang: The app was terminated while unresponsive0 libsystem_kernel.dylib +0x1804 _mach_msg2_trap
1 libsystem_kernel.dylib +0x5004 _mach_msg2_internal
2 IOKit +0x5438 _io_connect_method
3 IOKit +0x112a0 _IOConnectCallMethod
4 IOGPU +0x82bc _IOGPUResourceCreate
5 IOGPU +0x756c -[IOGPUMetalResource initWithDevice:options:args:argsSize:]
6 IOGPU +0x5afc -[IOGPUMetalBuffer initWithPrimaryBuffer:heapIndex:bufferIndex:bufferOffset:length:args:argsSize:]
7 AGXMetalG16P_B0 +0x9ca9c -[AGXBuffer(Internal) initWithDevice:length:alignment:options:isSuballocDisabled:resourceInArgs:pinnedGPULocation:]
8 AGXMetalG16P_B0 +0x9c89c -[AGXBuffer initWithDevice:length:alignment:options:isSuballocDisabled:pinnedGPULocation:]
9 MapboxCoreMaps +0xf0088 mbgl::metal::DrawScopeResource::getBuffer(mbgl::metal::Context&, unsigned long long)
10 MapboxCoreMaps +0x117c38 _ZN4mbgl5metal7ProgramINS_12ModelProgramEE6doDrawERNS0_7ContextERNS0_10RenderPassENS_3gfx10RenderModeERKNS8_8DrawModeERKNS8_9DepthModeERKNS8_11StencilModeERKNS8_9ColorModeERKNS8_12CullFaceModeERKNS8_13UniformValuesINS_8TypeListIJNS_8uniforms6matrixENSR_15lighting_matrixENSR_13normal_matrixENSR_7opacityENSR_9color_mixENSR_15baseColorFactorENSR_14metallicFactorENSR_15roughnessFactorENSR_14emissiveFactorENSR_10lightcolorENSR_8lightposENSR_14lightintensityENSR_10camera_posENSR_18baseTextureIsAlphaENSR_14inv_depth_sizeENSR_9alphaMaskENSR_11alphaCutoffENSR_11aoIntensityENSR_24indicator_cutout_centersENSR_23indicator_cutout_paramsENSR_13cutoff_paramsENSR_17emissive_strengthENSR_25occlusionTextureTransformEEEEEERNS0_17DrawScopeResourceERKNS8_17AttributeBindingsINSQ_IJNS_10attributes6pos_3fENS1M_9normal_3fENS1M_8color_3fENS1M_8color_4fENS1M_5uv_2fENS1M_3pbrENS1M_27heightBasedEmissiveStrengthENS1M_14normal_matrix0ENS1M_14normal_matrix1ENS1M_14normal_matrix2ENS1M_14normal_matrix3EEEEEERKNS8_15TextureBindingsINSQ_IJNS_8textures16baseColorTextureENS23_24metallicRoughnessTextureENS23_13normalTextureENS23_15emissionTextureENS23_16occlusionTextureENS23_12depthTextureEEEEEERKNS8_11IndexBufferEmmj
11 MapboxCoreMaps +0x1166f0 _ZN4mbgl5metal7ProgramINS_12ModelProgramEE4drawERNS_3gfx7ContextERNS4_10RenderPassENS4_10RenderModeERKNS4_8DrawModeERKNS4_9DepthModeERKNS4_11StencilModeERKNS4_9ColorModeERKNS4_12CullFaceModeERKNS4_13UniformValuesINS_8TypeListIJNS_8uniforms6matrixENSR_15lighting_matrixENSR_13normal_matrixENSR_7opacityENSR_9color_mixENSR_15baseColorFactorENSR_14metallicFactorENSR_15roughnessFactorENSR_14emissiveFactorENSR_10lightcolorENSR_8lightposENSR_14lightintensityENSR_10camera_posENSR_18baseTextureIsAlphaENSR_14inv_depth_sizeENSR_9alphaMaskENSR_11alphaCutoffENSR_11aoIntensityENSR_24indicator_cutout_centersENSR_23indicator_cutout_paramsENSR_13cutoff_paramsENSR_17emissive_strengthENSR_25occlusionTextureTransformEEEEEERNS4_9DrawScopeERKNS4_17AttributeBindingsINSQ_IJNS_10attributes6pos_3fENS1M_9normal_3fENS1M_8color_3fENS1M_8color_4fENS1M_5uv_2fENS1M_3pbrENS1M_27heightBasedEmissiveStrengthENS1M_14normal_matrix0ENS1M_14normal_matrix1ENS1M_14normal_matrix2ENS1M_14normal_matrix3EEEEEERKNS4_15TextureBindingsINSQ_IJNS_8textures16baseColorTextureENS23_24metallicRoughnessTextureENS23_13normalTextureENS23_15emissionTextureENS23_16occlusionTextureENS23_12depthTextureEEEEEERKNS4_11IndexBufferEmmjb
12 MapboxCoreMaps +0x2f5a30 (anonymous namespace)::renderInstanced(mbgl::models::Node const&, mbgl::ModelBucket::NodeAttributes&, (anonymous namespace)::LayerParameters const&, mbgl::PaintParameters&, mbgl::gfx::StencilMode const&, glm::mat<4, 4, double, (glm::qualifier)0> const&, mbgl::UnwrappedTileID const&, glm::vec<3, float, (glm::qualifier)0> const&, std::__1::basic_string<char, std::__1::char_traits
Trace 2 in mbgl::metal::DrawScopeResource::getBuffer
0 libsystem_kernel.dylib +0x1804 _mach_msg2_trap 1 libsystem_kernel.dylib +0x5004 _mach_msg2_internal 2 IOKit +0x5438 _io_connect_method 3 IOKit +0x112a0 _IOConnectCallMethod 4 IOGPU +0x82bc _IOGPUResourceCreate 5 IOGPU +0x756c -[IOGPUMetalResource initWithDevice:options:args:argsSize:] 6 IOGPU +0x5afc -[IOGPUMetalBuffer initWithPrimaryBuffer:heapIndex:bufferIndex:bufferOffset:length:args:argsSize:] 7 AGXMetalG16P_B0 +0x9ca9c -[AGXBuffer(Internal) initWithDevice:length:alignment:options:isSuballocDisabled:resourceInArgs:pinnedGPULocation:] 8 AGXMetalG16P_B0 +0x9c89c -[AGXBuffer initWithDevice:length:alignment:options:isSuballocDisabled:pinnedGPULocation:] 9 MapboxCoreMaps +0xf0088 mbgl::metal::DrawScopeResource::getBuffer(mbgl::metal::Context&, unsigned long long) 10 MapboxCoreMaps +0x117c38 _ZN4mbgl5metal7ProgramINS_12ModelProgramEE6doDrawERNS0_7ContextERNS0_10RenderPassENS_3gfx10RenderModeERKNS8_8DrawModeERKNS8_9DepthModeERKNS8_11StencilModeERKNS8_9ColorModeERKNS8_12CullFaceModeERKNS8_13UniformValuesINS_8TypeListIJNS_8uniforms6matrixENSR_15lighting_matrixENSR_13normal_matrixENSR_7opacityENSR_9color_mixENSR_15baseColorFactorENSR_14metallicFactorENSR_15roughnessFactorENSR_14emissiveFactorENSR_10lightcolorENSR_8lightposENSR_14lightintensityENSR_10camera_posENSR_18baseTextureIsAlphaENSR_14inv_depth_sizeENSR_9alphaMaskENSR_11alphaCutoffENSR_11aoIntensityENSR_24indicator_cutout_centersENSR_23indicator_cutout_paramsENSR_13cutoff_paramsENSR_17emissive_strengthENSR_25occlusionTextureTransformEEEEEERNS0_17DrawScopeResourceERKNS8_17AttributeBindingsINSQ_IJNS_10attributes6pos_3fENS1M_9normal_3fENS1M_8color_3fENS1M_8color_4fENS1M_5uv_2fENS1M_3pbrENS1M_27heightBasedEmissiveStrengthENS1M_14normal_matrix0ENS1M_14normal_matrix1ENS1M_14normal_matrix2ENS1M_14normal_matrix3EEEEEERKNS8_15TextureBindingsINSQ_IJNS_8textures16baseColorTextureENS23_24metallicRoughnessTextureENS23_13normalTextureENS23_15emissionTextureENS23_16occlusionTextureENS23_12depthTextureEEEEEERKNS8_11IndexBufferEmmj 11 MapboxCoreMaps +0x1166f0 _ZN4mbgl5metal7ProgramINS_12ModelProgramEE4drawERNS_3gfx7ContextERNS4_10RenderPassENS4_10RenderModeERKNS4_8DrawModeERKNS4_9DepthModeERKNS4_11StencilModeERKNS4_9ColorModeERKNS4_12CullFaceModeERKNS4_13UniformValuesINS_8TypeListIJNS_8uniforms6matrixENSR_15lighting_matrixENSR_13normal_matrixENSR_7opacityENSR_9color_mixENSR_15baseColorFactorENSR_14metallicFactorENSR_15roughnessFactorENSR_14emissiveFactorENSR_10lightcolorENSR_8lightposENSR_14lightintensityENSR_10camera_posENSR_18baseTextureIsAlphaENSR_14inv_depth_sizeENSR_9alphaMaskENSR_11alphaCutoffENSR_11aoIntensityENSR_24indicator_cutout_centersENSR_23indicator_cutout_paramsENSR_13cutoff_paramsENSR_17emissive_strengthENSR_25occlusionTextureTransformEEEEEERNS4_9DrawScopeERKNS4_17AttributeBindingsINSQ_IJNS_10attributes6pos_3fENS1M_9normal_3fENS1M_8color_3fENS1M_8color_4fENS1M_5uv_2fENS1M_3pbrENS1M_27heightBasedEmissiveStrengthENS1M_14normal_matrix0ENS1M_14normal_matrix1ENS1M_14normal_matrix2ENS1M_14normal_matrix3EEEEEERKNS4_15TextureBindingsINSQ_IJNS_8textures16baseColorTextureENS23_24metallicRoughnessTextureENS23_13normalTextureENS23_15emissionTextureENS23_16occlusionTextureENS23_12depthTextureEEEEEERKNS4_11IndexBufferEmmjb 12 MapboxCoreMaps +0x2f5a30 (anonymous namespace)::renderInstanced(mbgl::models::Node const&, mbgl::ModelBucket::NodeAttributes&, (anonymous namespace)::LayerParameters const&, mbgl::PaintParameters&, mbgl::gfx::StencilMode const&, glm::mat const&, mbgl::UnwrappedTileID const&, glm::vec const&, std::__1::basic_stringTrace 3 in mbgl::metal::StreamBufferResource::update
0 libsystem_kernel.dylib +0x1804 _mach_msg2_trap 1 libsystem_kernel.dylib +0x5004 _mach_msg2_internal 2 IOKit +0x5438 _io_connect_method 3 IOKit +0x112a0 _IOConnectCallMethod 4 IOGPU +0x82bc _IOGPUResourceCreate 5 IOGPU +0x756c -[IOGPUMetalResource initWithDevice:options:args:argsSize:] 6 IOGPU +0x6d94 -[IOGPUMetalBuffer initWithDevice:pointer:length:alignment:options:sysMemSize:gpuAddress:args:argsSize:deallocator:] 7 AGXMetalG16P_B0 +0x9c9c0 -[AGXBuffer(Internal) initWithDevice:length:alignment:options:isSuballocDisabled:resourceInArgs:pinnedGPULocation:] 8 AGXMetalG16P_B0 +0x9c870 -[AGXBuffer(Internal) initWithDevice:length:options:isSuballocDisabled:resourceInArgs:pinnedGPULocation:] 9 AGXMetalG16P_B0 +0x9c804 -[AGXBuffer initWithDevice:length:options:isSuballocDisabled:pinnedGPULocation:] 10 AGXMetalG16P_B0 +0x9c764 -[AGXG16PFamilyDevice newBufferWithBytes:length:options:] 11 MapboxCoreMaps +0xed2a8 mbgl::metal::StreamBufferResource::update(mbgl::metal::UploadPass&, objc_object objcproto9MTLBuffer*, void const*, unsigned long) 12 MapboxCoreMaps +0xf4740 mbgl::metal::UploadPass::createVertexBufferResource(void const*, unsigned long, mbgl::gfx::BufferUsageType) 13 MapboxCoreMaps +0x27f64c mbgl::SymbolBucket::upload(mbgl::gfx::UploadPass&) 14 MapboxCoreMaps +0x5eb1ec std::__1::__function::__func<:geometrytile::onlayout>, unsigned long long)::$_2, std::__1::allocator<:geometrytile::onlayout>, unsigned long long)::$_2>, bool (mbgl::gfx::UploadPass&)>::operator()(mbgl::gfx::UploadPass&) 15 MapboxCoreMaps +0x365654 mbgl::Renderer::Impl::render(mbgl::RenderTree const&) 16 MapboxCoreMaps +0x35ae98 mbgl::Renderer::render(std::__1::shared_ptr<:updateparameters> const&) 17 MapboxCoreMaps +0xa3240 mapbox::maps::MapImpl::Impl::render() 18 MapboxCoreMaps +0x9e2b4 ___ZN6mapbox5metal15RendererBackend10createViewENSt3__110shared_ptrINS_4maps9MapClientEEENS_4base7WeakPtrINS4_19MapRendererDelegateEEE_block_invoke 19 MapboxMaps +0x1b4918 @objc MetalView.DelegateImpl.draw(in:) 20 MetalKit +0x74b0 -[MTKView draw] 21 MapboxMaps +0x1a5ed0 MapView.updateFromDisplayLink(displayLink:) 22 MapboxMaps +0x1a66a0 closure #1 in MapView.didMoveToWindow() 23 MapboxMaps +0xeec98 @objc ForwardingDisplayLinkTarget.update(with:) (ForwardingDispalyLinkTarget.swift:11:9) 24 QuartzCore +0xd0ec8 CA::Display::DisplayLinkItem::dispatch_(CA::SignPost::Interval&) 25 QuartzCore +0xcf22c CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) 26 QuartzCore +0xcedcc CA::Display::DisplayLink::dispatch_deferred_display_links(unsigned int) 27 UIKitCore +0xb7768
Same here. Sentry reports MXCPUException, crashes in onRender (iOS Version:17.5.1, iPhone XS)
class MetalView: MTKView, CoreMetalView { private class DelegateImpl: NSObject, MTKViewDelegate { var onRender: (() -> Void)? func mtkView(_ view: MTKView, drawableSizeWillChange size: CGSize) {} func draw(in view: MTKView) { onRender?() } }
I had the same issue, but I noticed that the problem was resolved when I set the mapStyle for the map. Maybe this solution will work for you as well.
@evil159 any news with this issue? I'm facing this crash as well. I'm using the latest 11.7.0 version. It happens when I call these two methods for a heatmap we have on our Flutter app. I know this is Flutter/Dart code but I thought it might be helpful still.
await style.addSource(
RasterSource(
id: 'overall_heatmap',
tiles: heatmap.tiles,
tileSize: heatmap.tiles.length.toDouble(),
scheme: Scheme.XYZ,
minzoom: heatmap.minZoom,
maxzoom: heatmap.maxZoom,
bounds: heatmap.bounds,
),
);
await style.addLayer(
RasterLayer(
id: 'heatmap',
sourceId: 'overall_heatmap',
rasterResampling: RasterResampling.LINEAR,
),
);
I noticed these two call updateGeoJson internally
I have same issue. any update on this.I'm using following SDK versions
- MapboxCommon (24.7.0)
- MapboxCoreMaps (11.7.0):
- MapboxCommon (~> 24.7)
- MapboxCoreSearch (2.5.1):
- MapboxCommon (= 24.7.0)
- MapboxGeocoder.swift (0.15.0)
- MapboxMaps (11.7.0):
- MapboxCommon (= 24.7.0)
- MapboxCoreMaps (= 11.7.0)
- Turf (= 3.0.0)
- MapboxSearch (2.5.1):
- MapboxCommon (= 24.7.0)
- MapboxCoreSearch (= 2.5.1)
Same issue here, app crash on startup. This is stack traces:
iPhone 13 Pro 18.0.1
0 Metal -[_MTLLibrary newFunctionWithNameInternal:] + 164
1 Metal -[_MTLLibrary newFunctionWithNameInternal:] + 156
2 Metal -[_MTLLibrary newFunctionWithName:] + 28
3 Metal -[_MTLLibrary newFunctionWithName:constantValues:functionCache:specializedName:error:] + 60
4 MapboxCoreMaps mbgl::metal::createRenderPipeline(mbgl::metal::Context&, char const*, unsigned char, std::__1::vector<std::experimental::optionalmbgl::gfx::AttributeBinding, std::__1::allocator<std::experimental::optionalmbgl::gfx::AttributeBinding > > const&, mbgl::metal::AttachmentPixelFormats const&, mbgl::gfx::ColorMode const&, unsigned int, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits
iPhone 12 18.1
0 Metal -[_MTLLibrary newFunctionWithName:constantValues:functionCache:specializedName:error:] + 92
1 Metal -[_MTLLibrary newFunctionWithName:constantValues:functionCache:specializedName:error:] + 72
2 MapboxCoreMaps mbgl::metal::createRenderPipeline(mbgl::metal::Context&, char const*, unsigned char, std::__1::vector<std::experimental::optionalmbgl::gfx::AttributeBinding, std::__1::allocator<std::experimental::optionalmbgl::gfx::AttributeBinding > > const&, mbgl::metal::AttachmentPixelFormats const&, mbgl::gfx::ColorMode const&, unsigned int, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits
iPhone 15 Pro 18.1
0 Metal -[_MTLLibrary newFunctionWithName:constantValues:functionCache:specializedName:error:] + 92 1 Metal -[_MTLLibrary newFunctionWithName:constantValues:functionCache:specializedName:error:] + 72 2 MapboxCoreMaps mbgl::metal::createRenderPipeline(mbgl::metal::Context&, char const*, unsigned char, std::__1::vector<:experimental::optional>, std::__1::allocator<:experimental::optional> > > const&, mbgl::metal::AttachmentPixelFormats const&, mbgl::gfx::ColorMode const&, unsigned int, std::__1::vector<:__1::basic_string std::__1::char_traits>, std::__1::allocatoriPad (9th generation) 18.0.1
0 AGXMetalA13 0x000000023e553000 + 320840 1 MapboxCoreMaps mbgl::metal::replaceTexture(id
Same here. In my case it crashes only when I started the app from Xcode.
We are experiencing the same issue on multiple devices, particularly on iPads, when updating the app. However, reinstalling the app seems to resolve the crash.
iOS 18.3 MapboxMap 11.9.1 MapboxCoreMaps 11.9.2 MapboxCommon 24.9.0
#0 (null) in mbgl::metal::Program<mbgl::SymbolIconProgram>::doDraw(mbgl::metal::Context&, mbgl::metal::RenderPass&, mbgl::gfx::RenderMode, mbgl::gfx::DrawMode const&, mbgl::gfx::DepthMode const&, mbgl::gfx::Ste... ()
#1 (null) in mbgl::metal::Program<mbgl::SymbolIconProgram>::draw(mbgl::gfx::Context&, mbgl::gfx::RenderPass&, mbgl::gfx::RenderMode, mbgl::gfx::DrawMode const&, mbgl::gfx::DepthMode const&, mbgl::gfx::StencilMo... ()
#2 (null) in void mbgl::SymbolProgram<mbgl::SymbolIconProgram, (mbgl::gfx::PrimitiveType)2, mbgl::TypeList<mbgl::attributes::pos_offset, mbgl::attributes::tex_size, mbgl::attributes::pixeloffset>, mbgl::TypeLis... ()
#3 (null) in decltype(auto) std::__1::__variant_detail::__visitation::__base::__dispatcher<1ul>::__dispatch[abi:v160006]<std::__1::__variant_detail::__visitation::__variant::__value_visitor<mbx::make_visitor<au... ()
#4 (null) in void mbgl::(anonymous namespace)::drawIcon<mbgl::RenderSymbolLayer::render(mbgl::PaintParameters&)::$_1>(mbgl::RenderSymbolLayer::render(mbgl::PaintParameters&)::$_1 const&, mbgl::RenderTile const&... ()
#5 (null) in mbgl::RenderSymbolLayer::render(mbgl::PaintParameters&) ()
#6 (null) in mbgl::LayerRenderItemImpl::render(mbgl::PaintParameters&) const ()
#7 (null) in mbgl::Renderer::Impl::render(mbgl::RenderTree const&) ()
#8 (null) in mbgl::Renderer::render(std::__1::shared_ptr<mbgl::UpdateParameters> const&) ()
#9 (null) in mapbox::maps::MapImpl::Impl::render() ()
#10 (null) in invocation function for block in mapbox::metal::RendererBackend::createView(std::__1::shared_ptr<mapbox::maps::MapClient>, mapbox::base::WeakPtr<mapbox::maps::MapRendererDelegate>) ()
#11 0x0000000100eec684 in MetalView.DelegateImpl.draw(in:) at /SourcePackages/checkouts/mapbox-maps-ios/Sources/MapboxMaps/Foundation/MetalView.swift:64
#12 0x0000000100eec684 in @objc MetalView.DelegateImpl.draw(in:) ()
#13 (null) in -[MTKView draw] ()
#14 0x0000000100eda888 in MapView.updateFromDisplayLink(displayLink:) at /SourcePackages/checkouts/mapbox-maps-ios/Sources/MapboxMaps/Foundation/MapView.swift:672
#15 0x0000000100edb058 in closure #1 in MapView.didMoveToWindow() at /SourcePackages/checkouts/mapbox-maps-ios/Sources/MapboxMaps/Foundation/MapView.swift:714
#16 0x0000000100ed0104 in ForwardingDisplayLinkTarget.update(with:) at /SourcePackages/checkouts/mapbox-maps-ios/Sources/MapboxMaps/Foundation/ForwardingDispalyLinkTarget.swift:11
#17 0x0000000100ed0104 in @objc ForwardingDisplayLinkTarget.update(with:) ()
#18 (null) in CA::Display::DisplayLinkItem::dispatch_(CA::SignPost::Interval<(CA::SignPost::CAEventCode)835322056>&) ()
#19 (null) in CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) ()
#20 (null) in CA::Display::DisplayLink::dispatch_deferred_display_links(unsigned int) ()
#21 (null) in _UIUpdateSequenceRun ()
#22 (null) in schedulerStepScheduledMainSection ()
#23 (null) in runloopSourceCallback ()
#24 (null) in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#25 (null) in __CFRunLoopDoSource0 ()
#26 (null) in __CFRunLoopDoSources0 ()
#27 (null) in __CFRunLoopRun ()
#28 (null) in CFRunLoopRunSpecific ()
#29 (null) in GSEventRunModal ()
#30 (null) in -[UIApplication _run] ()
#31 (null) in UIApplicationMain ()
#32 (null) in closure #1 in KitRendererCommon(_:) ()
#33 (null) in runApp<A>(_:) ()
#34 (null) in static App.main() ()
#35 (null) in static OurApp.$main() ()
#36 (null) in main ()
#37 (null) in start ()
Same here
MapBoxCommon 24.13.4 MapBoxCoreMaps 11.13.4 MapBoxMaps 11.13.4
Hardware Model: iPhone14,5
AppStoreTools: 16F7
AppVariant: 1:iPhone14,5:18
Code Type: ARM-64 (Native)
OS Version: iPhone OS 18.5 (22F76)
Baseband Version: 4.60.01
Report Version: 104
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001b0f9d0fc
Termination Reason: SIGNAL 5 Trace/BPT trap: 5
Terminating Process: exc handler [9561]
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 libsystem_malloc.dylib 0x00000001b0f9d0fc _xzm_xzone_malloc_from_tiny_chunk.cold.1 + 36 (xzone_malloc.c:995)
1 libsystem_malloc.dylib 0x00000001b0f69d28 _xzm_xzone_malloc_from_tiny_chunk + 612 (xzone_inline_internal.h:0)
2 libsystem_malloc.dylib 0x00000001b0f6964c _xzm_xzone_find_and_malloc_from_tiny_chunk + 112 (xzone_malloc.c:1538)
3 libsystem_malloc.dylib 0x00000001b0f69e84 _xzm_xzone_malloc_tiny_outlined + 312 (xzone_malloc.c:1810)
4 Metal 0x00000001a02bc234 allocElement + 120 (MTLRangeAllocator.c:94)
5 Metal 0x00000001a0315a08 MTLRangeAllocatorInit + 68 (MTLRangeAllocator.c:30)
6 IOGPU 0x0000000239f789e8 -[IOGPUMetalHeap initWithDevice:size:options:args:argsSize:desc:] + 420 (IOGPUMetalHeap.m:155)
7 AGXMetalG14 0x000000025ee95b88 -[AGXG14FamilyHeap initWithDevice:descriptor:] + 388 (agxa_heap_objc.mm:100)
8 MapboxCoreMaps 0x0000000108117fd4 0x107fd0000 + 1343444
9 MapboxCoreMaps 0x000000010849650c 0x107fd0000 + 5006604
10 MapboxCoreMaps 0x00000001084d67ec 0x107fd0000 + 5269484
11 MapboxCoreMaps 0x00000001084a3230 0x107fd0000 + 5059120
12 MapboxCoreMaps 0x000000010849c1b0 0x107fd0000 + 5030320
13 MapboxCoreMaps 0x00000001080adf6c 0x107fd0000 + 909164
14 MapboxCoreMaps 0x00000001080a45ac 0x107fd0000 + 869804
15 SmartMap 0x0000000105181ab8 MetalView.draw(_:) + 64 (MetalView.swift:75)
16 SmartMap 0x0000000105181ab8 @objc MetalView.draw(_:) + 140 (/<compiler-generated>:73)
17 MetalKit 0x000000023313ccf0 -[MTKView draw] + 132 (MTKView.m:1371)
18 SmartMap 0x0000000105170178 MapView.updateFromDisplayLink(displayLink:) + 1132 (MapView.swift:657)
19 SmartMap 0x0000000105170948 closure #1 in MapView.didMoveToWindow() + 68 (MapView.swift:699)
20 SmartMap 0x0000000105166978 ForwardingDisplayLinkTarget.update(with:) + 8 (ForwardingDispalyLinkTarget.swift:11)
21 SmartMap 0x0000000105166978 @objc ForwardingDisplayLinkTarget.update(with:) + 52 (/<compiler-generated>:10)
22 QuartzCore 0x00000001a22d51d0 CA::Display::DisplayLinkItem::dispatch_(CA::SignPost::Interval<(CA::SignPost::CAEventCode)835322056>&) + 48 (CADisplay.mm:6286)
23 QuartzCore 0x00000001a22d4dc8 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 876 (CADisplay.mm:5436)
24 QuartzCore 0x00000001a22d5364 CA::Display::DisplayLink::dispatch_deferred_display_links(unsigned int) + 360 (CADisplay.mm:4551)
25 UIKitCore 0x00000001a3045404 _UIUpdateSequenceRun + 84 (_UIUpdateSequence.mm:136)
26 UIKitCore 0x00000001a3044ab4 schedulerStepScheduledMainSection + 208 (_UIUpdateScheduler.m:1173)
27 UIKitCore 0x00000001a30401e4 runloopSourceCallback + 92 (_UIUpdateScheduler.m:1341)
28 CoreFoundation 0x00000001a075ca8c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1970)
29 CoreFoundation 0x00000001a075c8a4 __CFRunLoopDoSource0 + 172 (CFRunLoop.c:2014)
30 CoreFoundation 0x00000001a075c700 __CFRunLoopDoSources0 + 232 (CFRunLoop.c:2051)
31 CoreFoundation 0x00000001a075d080 __CFRunLoopRun + 840 (CFRunLoop.c:2969)
32 CoreFoundation 0x00000001a075ec3c CFRunLoopRunSpecific + 572 (CFRunLoop.c:3434)
33 GraphicsServices 0x00000001ed93d454 GSEventRunModal + 168 (GSEvent.c:2196)
34 UIKitCore 0x00000001a3171274 -[UIApplication _run] + 816 (UIApplication.m:3845)
35 UIKitCore 0x00000001a313ca28 UIApplicationMain + 336 (UIApplication.m:5540)
36 SmartMap 0x00000001049abc30 main + 64 (AppDelegate.swift:71)
37 dyld 0x00000001c7633f08 start + 6040 (dyldMain.cpp:1450)