maplibre / maplibre-native

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

Crash on iPadOS 15.8.x #2447

Closed nebszefler closed 1 month ago

nebszefler commented 1 month ago

Describe the bug We are seeing crashes in the map rendering on iPadOS 15.8.x when using the latest MapLibre release (6.4.2). We do not have the debug symbols so the stack trace is not particularly helpful but it seems like the MapLibre binary is calling an unsupported API in CoreFoundation

Fatal Exception: APINotSupported
0  CoreFoundation                 0x92c60 (Missing UUID eec1287d059b38c89bc158a0c8b1e6c2)
1  libobjc.A.dylib                0x14ee4 (Missing UUID f1b36686ed4835ef88960cea8e9da1c0)
2  CoreFoundation                 0x15d490 (Missing UUID eec1287d059b38c89bc158a0c8b1e6c2)
3  MapLibre                       0x4020bc (Missing UUID 84c2ae3ea28e36aebd96e0e97ea6675f)
4  MapLibre                       0x4269d0 (Missing UUID 84c2ae3ea28e36aebd96e0e97ea6675f)
5  MapLibre                       0x228910 (Missing UUID 84c2ae3ea28e36aebd96e0e97ea6675f)
6  MapLibre                       0x226d1c (Missing UUID 84c2ae3ea28e36aebd96e0e97ea6675f)
7  MapLibre                       0x9e004 (Missing UUID 84c2ae3ea28e36aebd96e0e97ea6675f)
8  MapLibre                       0x9df70 (Missing UUID 84c2ae3ea28e36aebd96e0e97ea6675f)
9  MapLibre                       0xbed38 (Missing UUID 84c2ae3ea28e36aebd96e0e97ea6675f)
10 MetalKit                       0x3b84 (Missing UUID a49a6e7814f63c70a93178d1eb1d4555)
11 QuartzCore                     0x303b0 (Missing UUID bfb3734830c8372384e17b04acacc5be)
12 QuartzCore                     0x43cc8 (Missing UUID bfb3734830c8372384e17b04acacc5be)
13 QuartzCore                     0x4c79c (Missing UUID bfb3734830c8372384e17b04acacc5be)
14 QuartzCore                     0x2f9a8 (Missing UUID bfb3734830c8372384e17b04acacc5be)
15 CoreFoundation                 0x3e76c (Missing UUID eec1287d059b38c89bc158a0c8b1e6c2)
16 CoreFoundation                 0xf974 (Missing UUID eec1287d059b38c89bc158a0c8b1e6c2)
17 CoreFoundation                 0xaefc (Missing UUID eec1287d059b38c89bc158a0c8b1e6c2)
18 CoreFoundation                 0x1e174 (Missing UUID eec1287d059b38c89bc158a0c8b1e6c2)
19 GraphicsServices               0x1988 (Missing UUID bb434d860991365fbed3c3923cf3073c)
20 UIKitCore                      0x4e5a88 (Missing UUID 9d3018772593385c8f72f075aa0b48fa)
21 UIKitCore                      0x27ef78 (Missing UUID 9d3018772593385c8f72f075aa0b48fa)
22 libswiftUIKit.dylib            0x27ee4 (Missing UUID 883d1a20d0603440adf27c37b7efb6bd)
23 komoot                         0xc558 main (AppDelegate.swift)

To Reproduce Steps to reproduce the behavior:

  1. Render a map on iPad running iPadOS 15.8.x
  2. The app crashes

Expected behavior Map should be rendered and the app should not crash

Platform information (please complete the following information):

Additional context This issue was not present on 5.13.0 (openGL version)

louwers commented 1 month ago

We have debug symbols available as part of the release. https://github.com/maplibre/maplibre-native/releases/tag/ios-v6.4.2

Apple has a guide for symbolicating crash reports if you want to try that: https://developer.apple.com/documentation/xcode/adding-identifiable-symbol-names-to-a-crash-report

nebszefler commented 1 month ago

I have added the debug symbols... We can now see the following stacktrace

Fatal Exception: APINotSupported
0  CoreFoundation                 0x92c60 (Missing UUID eec1287d059b38c89bc158a0c8b1e6c2)
1  libobjc.A.dylib                0x14ee4 (Missing UUID f1b36686ed4835ef88960cea8e9da1c0)
2  CoreFoundation                 0x15d490 (Missing UUID eec1287d059b38c89bc158a0c8b1e6c2)
3  MapLibre                       0x4003d8 mbgl::mtl::Context::renderTileClippingMasks(mbgl::gfx::RenderPass&, mbgl::RenderStaticData&, std::__1::vector<mbgl::shaders::ClipUBO, std::__1::allocator<mbgl::shaders::ClipUBO>> const&) + 424 (context.cpp:424)
4  MapLibre                       0x20f174 mbgl::PaintParameters::renderTileClippingMasks(std::__1::shared_ptr<std::__1::vector<std::__1::reference_wrapper<mbgl::RenderTile const>, std::__1::allocator<std::__1::reference_wrapper<mbgl::RenderTile const>>> const> const&) + 198 (paint_parameters.cpp:198)
5  MapLibre                       0x4268c8 mbgl::mtl::TileLayerGroup::render(mbgl::RenderOrchestrator&, mbgl::PaintParameters&) + 120 (tile_layer_group.cpp:120)
6  MapLibre                       0x2288ac mbgl::Renderer::Impl::render(mbgl::RenderTree const&, std::__1::shared_ptr<mbgl::UpdateParameters> const&) + 207 (__tree:207)
7  MapLibre                       0x226d1c mbgl::Renderer::render(std::__1::shared_ptr<mbgl::UpdateParameters> const&) + 294 (unique_ptr.h:294)
8  MapLibre                       0x9e004 MLNRenderFrontend::render() + 744 (shared_ptr.h:744)
9  MapLibre                       0x9df70 -[MLNMapView renderSync] + 1200 (MLNMapView.mm:1200)
10 MapLibre                       0xbed38 MLNMapViewImpl::render() + 24 (MLNMapView+Impl.mm:24)
11 MetalKit                       0x3b84 (Missing UUID a49a6e7814f63c70a93178d1eb1d4555)
12 QuartzCore                     0x303b0 (Missing UUID bfb3734830c8372384e17b04acacc5be)
13 QuartzCore                     0x43cc8 (Missing UUID bfb3734830c8372384e17b04acacc5be)
14 QuartzCore                     0x4c79c (Missing UUID bfb3734830c8372384e17b04acacc5be)
15 QuartzCore                     0x2f9a8 (Missing UUID bfb3734830c8372384e17b04acacc5be)
16 CoreFoundation                 0x3e76c (Missing UUID eec1287d059b38c89bc158a0c8b1e6c2)
17 CoreFoundation                 0xf974 (Missing UUID eec1287d059b38c89bc158a0c8b1e6c2)
18 CoreFoundation                 0xaefc (Missing UUID eec1287d059b38c89bc158a0c8b1e6c2)
19 CoreFoundation                 0x1e174 (Missing UUID eec1287d059b38c89bc158a0c8b1e6c2)
20 GraphicsServices               0x1988 (Missing UUID bb434d860991365fbed3c3923cf3073c)
21 UIKitCore                      0x4e5a88 (Missing UUID 9d3018772593385c8f72f075aa0b48fa)
22 UIKitCore                      0x27ef78 (Missing UUID 9d3018772593385c8f72f075aa0b48fa)
23 libswiftUIKit.dylib            0x27ee4 (Missing UUID 883d1a20d0603440adf27c37b7efb6bd)
24 komoot                         0xc558 main (AppDelegate.swift)
louwers commented 1 month ago

Thanks for the stack trace.

It looks like Metal is not supported on the iPad Air 2.

https://support.apple.com/en-us/102894

louwers commented 1 month ago

Maybe it does after all, but we're using some features that are not supported. https://gist.github.com/schwa/3893c225133fd93ae869492ff8fa1610

akernazhytski-lyft commented 1 month ago

we have crashes on these devices: "iPad5,1", "iPad5,2", "iPad5,3", "iPad5,4". other devices running 15.x iOS just assert without a crash with MTLValidateFeatureSupport:4854: failed assertionBase Vertex Instance Drawing is only supported on MTLGPUFamilyApple3 and later.'`

louwers commented 1 month ago

@nebszefler @akernazhytski-lyft Can you give an indication how critical support for the iPad Air 2 is?

We're deciding what to do, we might be able to implement a fallback for Apple2 devices (i.e. iPad Air 2, not sure if there are other devices).

nebszefler commented 1 month ago

@louwers Thank you for investigating... We have a high volume of users running 15.x and therefore cannot drop support for it - this means we need to continue to support these devices. We have had to temporarily drop back to the old MapLibre version which runs on openGL ES. That framework is deprecated on iOS so it can't be our long term solution.

louwers commented 1 month ago

@nebszefler We support iOS 12+. We just don't support the iPad Air 2 (right now).

nebszefler commented 1 month ago

@louwers Understood but we cannot drop support based on hardware (iPad Air 2) - we can only drop based on OS version. We had a substantial number of crashes as a result of the issue and there is no way (as far as I can tell) for us to protect against this, seeing as we cannot drop iOS 15 yet.

Note: iPad Air 2 cannot upgrade from iOS 15, this is why I mentioned the OS version

louwers commented 1 month ago

@nebszefler OK thanks for the clarification, it looks like we can work around the issue for iPad Air 2.

louwers commented 1 month ago

@nebszefler Just FYI we have a fix thanks to Alex.

Should be released tomorrow!

louwers commented 1 month ago

@nebszefler iPad Air 2 should work with the 6.5.0 release. https://github.com/maplibre/maplibre-native/releases/tag/ios-v6.5.0

Let us know if it works for you.

nebszefler commented 1 month ago

@louwers I confirm this issue now seems to be resolved. Many thanks for the fast turnaround 🎉