mapbox / mapbox/mapbox-maps-ios

Crash in mapbox::common::CleanupManager::cleanup()

Open
#2,174 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :beetle: needs info
Dominant language
Swift
Stars
601
Forks
196
PR merge metrics
No merged PRs in 30d

Description

## Environment

- Xcode version: 15.3
- iOS version: 17.5
- Devices affected: iPhone OS 17.5 (21F5058e)
- Maps SDK Version: V11.3.0

## Observed behavior and steps to reproduce

Run mapbox map and dismiss/display the map multiple times over 30 minutes using same SwiftUI view.

Observed: crash logfile from device
Exception Type: EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: FRONTBOARD 2343432205
:10815] failed to terminate gracefully after 5.0s
ProcessVisibility: Unknown
ProcessState: Running
WatchdogEvent: process-exit
WatchdogVisibility: Foreground
WatchdogCPUStatistics: (
"Elapsed total CPU time (seconds): 18.700 (user 14.430, system 4.270), 61% CPU",
"Elapsed application CPU time (seconds): 5.393, 17% CPU"
) reportType:CrashLog maxTerminationResistance:Interactive>

Triggered by Thread: 0

Kernel Triage:
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter

Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x1d3c651cc __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x1e7a126e4 _pthread_cond_wait + 1228
2 libc++.1.dylib 0x19b2a5504 std::__1::condition_variable::wait(std::__1::unique_lock&) + 28
3 libc++.1.dylib 0x19b2a8ea4 std::__1::__assoc_sub_state::__sub_wait(std::__1::unique_lock&) + 56
4 libc++.1.dylib 0x19b2a8df4 std::__1::__assoc_sub_state::copy() + 56
5 libc++.1.dylib 0x19b2a9198 std::__1::future::get() + 32
6 MapboxCommon 0x1049cfaf0 0x104860000 + 1506032
7 MapboxCommon 0x1049cf2bc 0x104860000 + 1503932
8 MapboxCommon 0x1049d0ed8 0x104860000 + 1511128
9 MapboxCommon 0x1049ccef0 0x104860000 + 1494768
10 MapboxCommon 0x1048bee20 mapbox::common::CleanupManager::cleanup() + 1364
11 CoreFoundation 0x18aed17b8 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 128
12 CoreFoundation 0x18aed16e8 ___CFXRegistrationPost_block_invoke + 88
13 CoreFoundation 0x18aed1630 _CFXRegistrationPost + 440
14 CoreFoundation 0x18aecfbf8 _CFXNotificationPost + 728
15 Foundation 0x189d5e574 -[NSNotificationCenter postNotificationName:object:userInfo:] + 92
16 UIKitCore 0x18dfc646c -[UIApplication _terminateWithStatus:] + 232
17 UIKitCore 0x18d29f630 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 112
18 UIKitCore 0x18d8ac134 -[_UISceneLifecycleMultiplexer forceExitWithTransitionContext:scene:] + 164
19 UIKitCore 0x18dfc1b34 -[UIApplication workspaceShouldExit:withTransitionContext:] + 164
20 FrontBoardServices 0x1a3ba03e8 __63-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:]_block_invoke_2 + 72
21 FrontBoardServices 0x1a3b686cc -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 168
22 FrontBoardServices 0x1a3ba0388 __63-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:]_block_invoke + 128
23 libdispatch.dylib 0x1044c27bc _dispatch_client_callout + 20
24 libdispatch.dylib 0x1044c61f0 _dispatch_block_invoke_direct + 300
25 FrontBoardServices 0x1a3b69d58 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 52
26 FrontBoardServices 0x1a3b69cd8 -[FBSMainRunLoopSerialQueue _targetQueue_performNextIfPossible] + 240
27 FrontBoardServices 0x1a3b69bb0 -[FBSMainRunLoopSerialQueue _performNextFromRunLoopSource] + 28
28 CoreFoundation 0x18aed6874 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
29 CoreFoundation 0x18aed6808 __CFRunLoopDoSource0 + 176
30 CoreFoundation 0x18aed4338 __CFRunLoopDoSources0 + 340
31 CoreFoundation 0x18aed34c4 __CFRunLoopRun + 828
32 CoreFoundation 0x18aed2d18 CFRunLoopRunSpecific + 608
33 GraphicsServices 0x1cfa461a8 GSEventRunModal + 164
34 UIKitCore 0x18d50f058 -[UIApplication _run] + 888
35 UIKitCore 0x18d5c304c UIApplicationMain + 340
36 SwiftUI 0x18f0babd4 0x18ecc8000 + 4139988
37 SwiftUI 0x18f06735c 0x18ecc8000 + 3797852
38 SwiftUI 0x18f073118 0x18ecc8000 + 3846424
39 AppName 0x10117075c static AppName.$main() + 40
40 AppName 0x101174548 main + 12
41 dyld 0x1ae917e4c start + 2240

## Expected behavior

No crash in MapboxCommon mapbox::common::CleanupManager::cleanup()

## Notes / preliminary analysis

Device CPU is already loaded at ~50% by the whole app operation.

## Additional links and references
The app makes use of multiple
- PointAnnotation (SymbolLayer), CircleAnnotation (CircleLayer), PolylineAnnotation (FillLayer) with Geojson sources
- Layer clustering
- queryRenderedFeatures

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the repeated SwiftUI map dismissal and display cycle on iOS 17.5 with Maps SDK V11.3.0, while monitoring CPU usage and the CleanupManager::cleanup() stack. Compare behavior with the listed annotation, clustering, GeoJSON, and queryRenderedFeatures usage; done means the repeated lifecycle cycle no longer causes the cleanup timeout or crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, swift
Domain
mobile, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.