maps: (iOS) App crashes in background EXC_BAD_ACCESS KERN_INVALID_ADDRESS
Describe the bug
My application displays a lot of images on the map using <MapboxGL.Images /> and <MapboxGL.SymbolLayer />. When the application is running in the background and iOS tries to reduce the memory usage, the app crashes with the following stack:
Crashed: com.apple.main-thread
0 Mapbox 0x102d87f58 mbgl::style::Style::Impl::removeImage(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 2581432
1 Mapbox 0x102bcb4ac non-virtual thunk to mbgl::Map::Impl::onRemoveUnusedStyleImages(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) + 760076
2 Mapbox 0x102c14f7c mbgl::ImageManager::reduceMemoryUse() + 1061852
3 Mapbox 0x102c61b30 mbgl::RenderOrchestrator::reduceMemoryUse() + 1376144
4 Mapbox 0x102c6b874 mbgl::Renderer::reduceMemoryUse() + 1416404
5 Mapbox 0x102e6fbc4 -[MGLMapView pauseRendering:] + 30944
6 Mapbox 0x102e6f924 -[MGLMapView didEnterBackground:] + 30272
7 CoreFoundation 0x1a51bd764 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 28
8 CoreFoundation 0x1a51bd718 ___CFXRegistrationPost_block_invoke + 52
9 CoreFoundation 0x1a51bccd4 _CFXRegistrationPost + 440
10 CoreFoundation 0x1a51bc6a0 _CFXNotificationPost + 704
11 Foundation 0x1a64545f4 -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
12 UIKitCore 0x1a7b8cdac __47-[UIApplication _applicationDidEnterBackground]_block_invoke + 316
13 UIKitCore 0x1a7493090 +[UIViewController _performWithoutDeferringTransitionsAllowingAnimation:actions:] + 164
14 UIKitCore 0x1a7b8cb44 -[UIApplication _applicationDidEnterBackground] + 144
15 UIKitCore 0x1a7216640 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke_2 + 904
16 UIKitCore 0x1a77616ec _UIScenePerformActionsWithLifecycleActionMask + 112
17 UIKitCore 0x1a7216220 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 224
18 UIKitCore 0x1a7215cec -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 484
19 UIKitCore 0x1a7216030 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 768
20 UIKitCore 0x1a72158a8 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 340
21 UIKitCore 0x1a721d9d8 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 196
22 UIKitCore 0x1a7673dfc +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 892
23 UIKitCore 0x1a7779a28 _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 272
24 UIKitCore 0x1a721d750 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 376
25 UIKitCore 0x1a7052748 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 776
26 UIKitCore 0x1a7051104 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 256
27 UIKitCore 0x1a7052370 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 248
28 UIKitCore 0x1a769c8f8 -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 492
29 FrontBoardServices 0x1b4248b78 -[FBSScene updater:didUpdateSettings:withDiff:transitionContext:completion:] + 484
30 FrontBoardServices 0x1b4274194 __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke_2 + 152
31 FrontBoardServices 0x1b4256d24 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 240
32 FrontBoardServices 0x1b42740c0 __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke + 384
33 libdispatch.dylib 0x1a4e5cac8 _dispatch_client_callout + 20
34 libdispatch.dylib 0x1a4e60348 _dispatch_block_invoke_direct + 268
35 FrontBoardServices 0x1b429a0e0 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 48
36 FrontBoardServices 0x1b4299d88 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 448
37 FrontBoardServices 0x1b429a2ac -[FBSSerialQueue _performNextFromRunLoopSource] + 32
38 CoreFoundation 0x1a51db81c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
39 CoreFoundation 0x1a51db718 __CFRunLoopDoSource0 + 208
40 CoreFoundation 0x1a51daa28 __CFRunLoopDoSources0 + 268
41 CoreFoundation 0x1a51d4d20 __CFRunLoopRun + 824
42 CoreFoundation 0x1a51d44bc CFRunLoopRunSpecific + 600
43 GraphicsServices 0x1bbce6820 GSEventRunModal + 164
44 UIKitCore 0x1a7b81164 -[UIApplication _run] + 1072
45 UIKitCore 0x1a7b86840 UIApplicationMain + 168
46 App 0x10217933c main + 7 (main.m:7)
47 libdyld.dylib 0x1a4e9be40 start + 4
This started occuring when I upgraded to the 8.1.0.rc9 version, it does not happen on the 8.1.0-rc.4 version. The difference is that rc9 uses mapbox iOS SDK 5.8.0 and rc4 uses iOS SDK 5.9.0.
To Reproduce Since this occurs when iOS tries to reduce memory usage by the application I am not sure what the easiest way to reproduce this is, other than displaying a bunch of images, starting another application and try to trigger iOS to reduce memory.
Expected behavior The application should have its memory reduced without crashing.
Versions (please complete the following information):
- Platform: iOS
- Device: iPhone 11
- Emulator/ Simulator: no
- OS: iOS 14.1.0 (18A8395)
- react-native-mapbox-gl Version 8.1.0.rc9
- React Native Version 0.63.3
Additional context The issue seems to be known and resolved in 5.9.0 with this PR: https://github.com/mapbox/mapbox-gl-native/pull/16391 which is the reason why it doesnt crash in rc4 which uses that iOS SDK version. Having future versions of this SDK use iOS SDK >= 5.9.0 should fix this if my understanding of the issue is correct.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 18 (9 by maintainers)
Commits related to this issue
- Update install.md Following ticket https://github.com/react-native-mapbox-gl/maps/issues/1103 to explain how to use a custom version of the Mapbox Maps SDK for iOS. — committed to mzu/maps by mzu 4 years ago
- Update install.md for ios: Mapbox Maps SDK (#1106) * Update install.md Following ticket https://github.com/react-native-mapbox-gl/maps/issues/1103 to explain how to use a custom version of the Map... — committed to rnmapbox/maps by mzu 4 years ago
- Use latest pod version Suggested by https://github.com/react-native-mapbox-gl/maps/issues/1103 — committed to AmauryLiet/maps by AmauryLiet 4 years ago
- Update install.md for ios: Mapbox Maps SDK (#1106) * Update install.md Following ticket https://github.com/react-native-mapbox-gl/maps/issues/1103 to explain how to use a custom version of the Map... — committed to TruckMap/maps by mzu 4 years ago
Closing as resolved - use newer iOS sdk
now it works for me, i had to add new TOKEN and give the DOWNLOADS:READ feature to the token
not sure, still looks like a credential setup issue https://docs.mapbox.com/help/troubleshooting/ios-sdk-installation/#mapbox-maps-sdk https://github.com/mapbox/mapbox-navigation-ios/issues/2692
Maybe you have to cache bust pods or something? I’m no iOS guy, sorry
I’m facing the same problem when adding $ReactNativeMapboxGLIOSVersion = ‘~> 6.2.1’ I’m using react native 63.3 and Mapbox @react-native-mapbox-gl/maps": “^8.1.0-rc.9”
`[!] Error installing @react-native-mapbox-gl-mapbox-static [!] /usr/bin/curl -f -L -o /var/folders/n5/33qj8l1n5lbfh700lfgbtk0r0000gn/T/d20201111-13256-1t84aqa/file.zip https://api.mapbox.com/downloads/v2/mobile-maps/releases/ios/6.2.1/mapbox-ios-sdk-dynamic-with-events.zip --create-dirs --netrc-optional --retry 2 -A ‘CocoaPods/1.10.0 cocoapods-downloader/1.4.0’
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0 curl: (22) The requested URL returned error: 401 Unauthorized`
Works for me as well. Plus making sure that the .netrc file is in the home directory on your Mac. I had it in my project folder which was wrong.
Added
$ReactNativeMapboxGLIOSVersion = '~> 6.2.1'to/ios/Podfilepod installproduces following error:I have the access token set inside
~/.netrcaccording to mapbox docs.Any ideas?