Xcode 15.3 and iOS 17.4 generate a CPU spike when launching the app

I've just updated to Xcode 15.3 and iOS 17.4 (simulator). Every time I launch the app, I see a CPU spike keeping the CPU at 100% for about 30 seconds on a background thread. After those 30 seconds, there's a 'Thread Performance Checker' error posted on the console.

This does not happen when using Xcode 15.2 and running on iOS 17.2. or iOS 16.4.

Thread Performance Checker: Thread running at User-initiated quality-of-service class waiting on a thread without a QoS class specified (base priority 33). Investigate ways to avoid priority inversions
PID: 70633, TID: 2132693
Backtrace
=================================================================
3   CFNetwork                           0x000000018454094c estimatedPropertyListSize + 28648
4   CFNetwork                           0x00000001843d7fc0 cfnTranslateCFError + 1864
5   libdispatch.dylib                   0x000000010557173c _dispatch_client_callout + 16
6   libdispatch.dylib                   0x0000000105573210 _dispatch_once_callout + 84
7   CFNetwork                           0x00000001843d7f8c cfnTranslateCFError + 1812
8   CFNetwork                           0x0000000184540814 estimatedPropertyListSize + 28336
9   libdispatch.dylib                   0x000000010557173c _dispatch_client_callout + 16
10  libdispatch.dylib                   0x0000000105573210 _dispatch_once_callout + 84
11  CFNetwork                           0x0000000184540728 estimatedPropertyListSize + 28100
12  CFNetwork                           0x0000000184540794 estimatedPropertyListSize + 28208
13  libdispatch.dylib                   0x000000010557173c _dispatch_client_callout + 16
14  libdispatch.dylib                   0x0000000105573210 _dispatch_once_callout + 84
15  CFNetwork                           0x0000000184540780 estimatedPropertyListSize + 28188
16  CFNetwork                           0x00000001844e8664 _CFNetworkHTTPConnectionCacheSetLimit + 191584
17  CFNetwork                           0x00000001844e78dc _CFNetworkHTTPConnectionCacheSetLimit + 188120
18  CFNetwork                           0x000000018439ce5c _CFURLCachePersistMemoryToDiskNow + 25460
19  CFNetwork                           0x0000000184483068 _CFStreamErrorFromCFError + 609680
20  CFNetwork                           0x000000018445105c _CFStreamErrorFromCFError + 404868
21  CFNetwork                           0x000000018443a040 _CFStreamErrorFromCFError + 310632
22  CFNetwork                           0x000000018453be14 estimatedPropertyListSize + 9392
23  CFNetwork                           0x000000018440fa5c _CFStreamErrorFromCFError + 137092
26  CFNetwork                           0x000000018445b398 _CFStreamErrorFromCFError + 446656
27  CFNetwork                           0x0000000184459db8 _CFStreamErrorFromCFError + 441056
28  CFNetwork                           0x000000018445cf60 _CFStreamErrorFromCFError + 453768
29  CFNetwork                           0x0000000184541838 estimatedPropertyListSize + 32468
30  libdispatch.dylib                   0x000000010556fec4 _dispatch_call_block_and_release + 24
31  libdispatch.dylib                   0x000000010557173c _dispatch_client_callout + 16
32  libdispatch.dylib                   0x0000000105579a30 _dispatch_lane_serial_drain + 916
33  libdispatch.dylib                   0x000000010557a774 _dispatch_lane_invoke + 420
34  libdispatch.dylib                   0x000000010557b6e4 _dispatch_workloop_invoke + 864
35  libdispatch.dylib                   0x00000001055871a8 _dispatch_root_queue_drain_deferred_wlh + 324
36  libdispatch.dylib                   0x0000000105586604 _dispatch_workloop_worker_thread + 488
37  libsystem_pthread.dylib             0x0000000106b87924 _pthread_wqthread + 284
38  libsystem_pthread.dylib             0x0000000106b866e4 start_wqthread + 8

This seems to be related to the fix on 'Thread Performance Checker': https://developer.apple.com/documentation/xcode-release-notes/xcode-15_3-release-notes#Thread-Performance-Checker

If I disable it on the running scheme, the CPU spike is gone. Since the backtrace seems to be all internal to the OS (no calls to our app are being logged), it doesn't look like there's anything I can do until Apple fixes it internally, right?

I'm seeing the same thing. CPU spike for about a minute when launching the app from Xcode to debug on iPhone and the app hangs on the launch screen for the duration.

Wasn't experiencing the issue with Xcode 15.2, installed Xcode 15.3, code unchanged and the issue started.

Edit: As suggested above, going to Edit Scheme > Run > Diagnostics and disabling Thread Performance Checker resolved the issue for me.

Xcode 15.3 & iPadOS 17.4

I updated to Xcode 15.3 and one of my test iPads to iPadOS 17.4 and started receiving the following when I side load one of my apps:

  • "AddressSanitizer report breakpoint hit. Use 'thread info -s' to get extended information about the report."

  • "Logging Error: Failed to initialize logging system. Log messages may be missing. If this issue persists, try setting IDEPreferLogStreaming=YES in the active scheme actions environment variables."

I ran "thread info -s" and received -> "thread #1: tid = 0x1563, 0x0000000105f0d708 libclang_rt.asan_ios_dynamic.dylib`__asan::AsanDie()"

Xcode 15.3 & iPadOS 17.3.1

I have a second iPad that is still on iPadOS 17.3.1 and I can side load using Xcode 15.3 without any warnings or issues.

Thanks for your suggestion(s) "xmollv" and "alexcason" -> I will try disabling "Thread Performance Checker" and see what happens when I side load on my 17.4 iPad.

I even do not get an error by the "Thread Performance Checker" but keeping the option enabled in Xcode 15.3 results in horrible performance of the app during the full utilization of the app (I'm making intensive use of background threads).

The only option currently possible is deactivate this feature in Debug Scheme. (Filed bug report: FB13681777)

Also seeing this after upgrading from the prior Map(coordinateRegion: $region, showsUserLocation: true, annotationItems: $items) initializer to the preferred Map(position: $position) {} construct given deprecation warning from iOS 17.

I have trimmed my entire implementation down to native code without any type of thread behavior from my side. Definitely coming from internal MapKit itself.

Happens the first time Map loads. Sometimes the stack is larger.

Happening on iOS 17.2 15 Pro Max. Xcode 15.3.

Thread Performance Checker: Thread running at User-interactive quality-of-service class waiting on a thread without a QoS class specified. Investigate ways to avoid priority inversions
PID: 83774, TID: 4546305
Backtrace
=================================================================
3   VectorKit                           0x0000000193a124e0 ___ZN3geo9TaskQueue5applyEmNSt3__18functionIFvmEEE_block_invoke + 40
4   libdispatch.dylib                   0x00000001028f9978 _dispatch_client_callout2 + 16
5   libdispatch.dylib                   0x000000010290fbd4 _dispatch_apply_redirect_invoke + 376
6   libdispatch.dylib                   0x00000001028f993c _dispatch_client_callout + 16
7   libdispatch.dylib                   0x000000010290d6f4 _dispatch_root_queue_drain + 940
8   libdispatch.dylib                   0x000000010290e068 _dispatch_worker_thread2 + 256
9   libsystem_pthread.dylib             0x00000001014677d8 _pthread_wqthread + 224
10  libsystem_pthread.dylib             0x00000001014665d4 start_wqthread + 8

Managed to pull a new warning that points to a specific line of code:

Tracking a LayerData with no associated Registry: Assertion with expression - layerDataSets.keys.exiting.empty() : Failed in file - /Library/Caches/com.apple.xbs/Sources/VectorKit_Sim/src/RegistryManager.mm line - 475

I have seen similar log for ARKitCore. It seems to be an ARKit internal issue.

Thread Performance Checker: Thread running at User-initiated quality-of-service class waiting on a lower QoS thread running at Default quality-of-service class. Investigate ways to avoid priority inversions
PID: 14603, TID: 6216861
Backtrace
=================================================================
3   ARKitCore                           0x00000001cb1bfd68 531C4275-B554-3D3A-88B7-3C9CE4D952C3 + 441704
4   libdispatch.dylib                   0x0000000101f88f50 _dispatch_call_block_and_release + 32
5   libdispatch.dylib                   0x0000000101f8ab34 _dispatch_client_callout + 20
6   libdispatch.dylib                   0x0000000101f9298c _dispatch_lane_serial_drain + 832
7   libdispatch.dylib                   0x0000000101f9375c _dispatch_lane_invoke + 460
8   libdispatch.dylib                   0x0000000101f94d6c _dispatch_workloop_invoke + 2336
9   libdispatch.dylib                   0x0000000101fa05f8 _dispatch_root_queue_drain_deferred_wlh + 328
10  libdispatch.dylib                   0x0000000101f9fc2c _dispatch_workloop_worker_thread + 444
11  libsystem_pthread.dylib             0x0000000205f2f964 _pthread_wqthread + 288
12  libsystem_pthread.dylib             0x0000000205f2fa04 start_wqthread + 8

MapKit

SwiftUI + iOS 17:

3   CMPhoto                             0x00000001ca20001c EA7CA3FB-45FC-3BE7-BAE8-2376F457E0EE + 266268
4   CMPhoto                             0x00000001ca1fe89c EA7CA3FB-45FC-3BE7-BAE8-2376F457E0EE + 260252
5   CMPhoto                             0x00000001ca1fe400 EA7CA3FB-45FC-3BE7-BAE8-2376F457E0EE + 259072
6   CMPhoto                             0x00000001ca1db524 EA7CA3FB-45FC-3BE7-BAE8-2376F457E0EE + 116004
7   CMPhoto                             0x00000001ca1caa20 EA7CA3FB-45FC-3BE7-BAE8-2376F457E0EE + 47648
8   CMPhoto                             0x00000001ca234434 EA7CA3FB-45FC-3BE7-BAE8-2376F457E0EE + 480308
9   CMPhoto                             0x00000001ca23044c EA7CA3FB-45FC-3BE7-BAE8-2376F457E0EE + 463948
10  CMPhoto                             0x00000001ca1e65dc CMPhotoDecompressionContainerCreateImageForIndex + 280
11  ImageIO                             0x00000001aad4b0a8 F39503B4-AD21-3FE3-9AF2-11C6406E46FB + 1904808
12  ImageIO                             0x00000001aad4d700 F39503B4-AD21-3FE3-9AF2-11C6406E46FB + 1914624
13  ImageIO                             0x00000001aabb0ebc F39503B4-AD21-3FE3-9AF2-11C6406E46FB + 224956
14  ImageIO                             0x00000001aabb07b4 F39503B4-AD21-3FE3-9AF2-11C6406E46FB + 223156
15  ImageIO                             0x00000001aabb041c F39503B4-AD21-3FE3-9AF2-11C6406E46FB + 222236
16  ImageIO                             0x00000001aabb0050 F39503B4-AD21-3FE3-9AF2-11C6406E46FB + 221264
17  CoreGraphics                        0x00000001a6be5a30 2BD47BB8-DE13-3B66-AE04-98EE0A7A08A0 + 375344
18  CoreGraphics                        0x00000001a6bcfea4 2BD47BB8-DE13-3B66-AE04-98EE0A7A08A0 + 286372
19  CoreGraphics                        0x00000001a6bcfeec 2BD47BB8-DE13-3B66-AE04-98EE0A7A08A0 + 286444
20  CoreGraphics                        0x00000001a6bcfea4 2BD47BB8-DE13-3B66-AE04-98EE0A7A08A0 + 286372
21  CoreGraphics                        0x00000001a6bcfb70 CGAccessSessionCreate + 124
22  CoreGraphics                        0x00000001a6bcd2d0 2BD47BB8-DE13-3B66-AE04-98EE0A7A08A0 + 275152
23  CoreGraphics                        0x00000001a6bcc864 2BD47BB8-DE13-3B66-AE04-98EE0A7A08A0 + 272484
24  CoreGraphics                        0x00000001a6bd796c 2BD47BB8-DE13-3B66-AE04-98EE0A7A08A0 + 317804
25  CoreGraphics                        0x00000001a6bd71a8 2BD47BB8-DE13-3B66-AE04-98EE0A7A08A0 + 315816
26  CoreGraphics                        0x00000001a6bd6ce0 CGContextDrawImageWithOptions + 1120
27  VectorKit                           0x00000001c2a9b264 75195D59-5670-3494-8B35-3F99E78BB358 + 10371684
28  VectorKit                           0x00000001c2a9b7b8 75195D59-5670-3494-8B35-3F99E78BB358 + 10373048
29  VectorKit                           0x00000001c248fe14 75195D59-5670-3494-8B35-3F99E78BB358 + 4034068
30  VectorKit                           0x00000001c2491c0c 75195D59-5670-3494-8B35-3F99E78BB358 + 4041740
31  VectorKit                           0x00000001c2b4efbc 75195D59-5670-3494-8B35-3F99E78BB358 + 11108284
32  VectorKit                           0x00000001c278d898 75195D59-5670-3494-8B35-3F99E78BB358 + 7170200
33  VectorKit                           0x00000001c278cac8 75195D59-5670-3494-8B35-3F99E78BB358 + 7166664
34  GeoServices                         0x00000001ab6a6734 4EF7FB5D-FB2E-33A8-9CFD-82B79F82C945 + 3647284
35  GeoServices                         0x00000001ab6b20fc 4EF7FB5D-FB2E-33A8-9CFD-82B79F82C945 + 3694844
36  libdispatch.dylib                   0x000000010151b764 _dispatch_block_async_invoke2 + 148
37  libdispatch.dylib                   0x000000010150a7bc _dispatch_client_callout + 20
38  libdispatch.dylib                   0x000000010150d8e0 _dispatch_continuation_pop + 676
39  libdispatch.dylib                   0x000000010150cbb8 _dispatch_async_redirect_invoke + 680
40  libdispatch.dylib                   0x000000010151eae4 _dispatch_root_queue_drain + 404
41  libdispatch.dylib                   0x000000010151f4d8 _dispatch_worker_thread2 + 188
42  libsystem_pthread.dylib             0x0000000200fa0ee4 _pthread_wqthread + 228
43  libsystem_pthread.dylib             0x0000000200fa0fc0 start_wqthread + 8

Same here, similar log.

Thread Performance Checker: Thread running at User-initiated quality-of-service class waiting on a thread without a QoS class specified (base priority 33). Investigate ways to avoid priority inversions
PID: 12503, TID: 4916683
Backtrace
=================================================================
3   CFNetwork                           0x000000018e32ca08 estimatedPropertyListSize + 37652
4   CFNetwork                           0x000000018e1973a8 cfnTranslateCFError + 2688
5   libdispatch.dylib                   0x0000000107ff67bc _dispatch_client_callout + 20
6   libdispatch.dylib                   0x0000000107ff834c _dispatch_once_callout + 140
7   CFNetwork                           0x000000018e19737c cfnTranslateCFError + 2644
8   CFNetwork                           0x000000018e32c8c8 estimatedPropertyListSize + 37332
9   libdispatch.dylib                   0x0000000107ff67bc _dispatch_client_callout + 20
10  libdispatch.dylib                   0x0000000107ff834c _dispatch_once_callout + 140
11  CFNetwork                           0x000000018e32c790 estimatedPropertyListSize + 37020
12  CFNetwork                           0x000000018e32c81c estimatedPropertyListSize + 37160
13  libdispatch.dylib                   0x0000000107ff67bc _dispatch_client_callout + 20
14  libdispatch.dylib                   0x0000000107ff834c _dispatch_once_callout + 140
15  CFNetwork                           0x000000018e32c804 estimatedPropertyListSize + 37136
16  CFNetwork                           0x000000018e2c90a8 CFHTTPCookieStorageUnscheduleFromRunLoop + 277468
17  CFNetwork                           0x000000018e2c9038 CFHTTPCookieStorageUnscheduleFromRunLoop + 277356
18  CFNetwork                           0x000000018e15704c _CFURLCacheLoadMemoryFromDiskNow + 26196
19  CFNetwork                           0x000000018e2598b8 _CFStreamErrorFromCFError + 695792
20  CFNetwork                           0x000000018e22b334 _CFStreamErrorFromCFError + 505964
21  CFNetwork                           0x000000018e20410c _CFStreamErrorFromCFError + 345668
22  CFNetwork                           0x000000018e327c68 estimatedPropertyListSize + 17780
23  CFNetwork                           0x000000018e1d42c0 _CFStreamErrorFromCFError + 149496
24  CFNetwork                           0x000000018e0e2c00 _CFNetworkSetHSTSStoragePath + 35396
25  CFNetwork                           0x000000018e0e281c _CFNetworkSetHSTSStoragePath + 34400
26  CFNetwork                           0x000000018e21f7cc _CFStreamErrorFromCFError + 457988
27  CFNetwork                           0x000000018e21e4e4 _CFStreamErrorFromCFError + 453148
28  CFNetwork                           0x000000018e221468 _CFStreamErrorFromCFError + 465312
29  CFNetwork                           0x000000018e32d8f8 estimatedPropertyListSize + 41476
30  libdispatch.dylib                   0x0000000107ff4b98 _dispatch_call_block_and_release + 32
31  libdispatch.dylib                   0x0000000107ff67bc _dispatch_client_callout + 20
32  libdispatch.dylib                   0x0000000107ffe66c _dispatch_lane_serial_drain + 832
33  libdispatch.dylib                   0x0000000107fff43c _dispatch_lane_invoke + 460
34  libdispatch.dylib                   0x0000000108000abc _dispatch_workloop_invoke + 2336
35  libdispatch.dylib                   0x000000010800c404 _dispatch_root_queue_drain_deferred_wlh + 328
36  libdispatch.dylib                   0x000000010800ba38 _dispatch_workloop_worker_thread + 444
37  libsystem_pthread.dylib             0x00000001e8f7cf20 _pthread_wqthread + 288
38  libsystem_pthread.dylib             0x00000001e8f7cfc0 start_wqthread + 8

Same here with PhotoKit.

Using PHImageManager requestAVAsset method:

Thread Performance Checker: Thread running at User-initiated quality-of-service class waiting on a lower QoS thread running at Default quality-of-service class. Investigate ways to avoid priority inversions
PID: 6021, TID: 11317127
Backtrace
=================================================================
3   PhotosFormats                       0x00000001a4f812f4 -[PFVideoAVObjectBuilder _synchronouslyLoadSlowMotionPropertiesFromAsset:] + 172
4   PhotosFormats                       0x00000001a4f811d0 -[PFVideoAVObjectBuilder requestAVAssetForExport:withResultHandler:] + 224
5   Photos                              0x0000000190467c90 +[PHImageManager(VideoUtilities) buildAVAssetFromVideoURL:infoDictionary:options:completion:] + 244
6   Photos                              0x00000001904fb748 __63-[PHImageManager requestAVAssetForAsset:options:resultHandler:]_block_invoke_2 + 352
7   Photos                              0x0000000190449570 -[PHVideoRequestContext processMediaResult:forRequest:] + 264
8   Photos                              0x0000000190366e64 -[PHMediaRequestContext mediaRequest:didFinishWithResult:] + 396
9   Photos                              0x00000001903697b8 -[PHVideoRequest _finish] + 80
10  Photos                              0x0000000190369878 -[PHVideoRequest _handleResultVideoURL:mediaItemMakerData:fingerPrint:info:error:] + 172
11  Photos                              0x000000019036a430 __30-[PHVideoRequest startRequest]_block_invoke + 1400
12  CoreFoundation                      0x0000000180497750 __invoking___ + 144
13  CoreFoundation                      0x0000000180494ab4 -[NSInvocation invoke] + 276
14  Foundation                          0x0000000180eac7e0 __NSXPCCONNECTION_IS_CALLING_OUT_TO_REPLY_BLOCK__ + 12
15  Foundation                          0x0000000180eac418 -[NSXPCConnection _decodeAndInvokeReplyBlockWithEvent:sequence:replyInfo:] + 472
16  Foundation                          0x0000000180eb0434 __88-[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:]_block_invoke_5 + 184
17  libxpc.dylib                        0x00000001800c92e0 _xpc_connection_reply_callout + 60
18  libxpc.dylib                        0x00000001800bcd30 _xpc_connection_call_reply_async + 76
19  libdispatch.dylib                   0x00000001012c59b4 _dispatch_client_callout3 + 16
20  libdispatch.dylib                   0x00000001012e4bcc _dispatch_mach_msg_async_reply_invoke + 572
21  libdispatch.dylib                   0x00000001012cd998 _dispatch_lane_serial_drain + 340
22  libdispatch.dylib                   0x00000001012ce91c _dispatch_lane_invoke + 420
23  libdispatch.dylib                   0x00000001012db2f8 _dispatch_root_queue_drain_deferred_wlh + 324
24  libdispatch.dylib                   0x00000001012da754 _dispatch_workloop_worker_thread + 488
25  libsystem_pthread.dylib             0x000000010281b814 _pthread_wqthread + 284
26  libsystem_pthread.dylib             0x000000010281a5d4 start_wqthread + 8

Same warning here with MapKit.

Thread Performance Checker: Thread running at User-interactive quality-of-service class waiting on a thread without a QoS class specified (base priority 0). Investigate ways to avoid priority inversions
PID: 77670, TID: 5270783
Backtrace
=================================================================
3   VectorKit                           0x0000000193fef1a4 ___ZN3geo9TaskQueue5applyEmNSt3__18functionIFvmEEE_block_invoke + 40
4   libdispatch.dylib                   0x00000001033e9778 _dispatch_client_callout2 + 16
5   libdispatch.dylib                   0x000000010340066c _dispatch_apply_invoke3 + 400
6   libdispatch.dylib                   0x00000001033e973c _dispatch_client_callout + 16
7   libdispatch.dylib                   0x00000001033eb210 _dispatch_once_callout + 84
8   libdispatch.dylib                   0x00000001033ff898 _dispatch_apply_redirect_invoke + 232
9   libdispatch.dylib                   0x00000001033e973c _dispatch_client_callout + 16
10  libdispatch.dylib                   0x00000001033fd5a4 _dispatch_root_queue_drain + 940
11  libdispatch.dylib                   0x00000001033fdf18 _dispatch_worker_thread2 + 256
12  libsystem_pthread.dylib             0x00000001033437d8 _pthread_wqthread + 224
13  libsystem_pthread.dylib             0x00000001033425d4 start_wqthread + 8

Using Map(position: $cameraPosition) { } initializer.

same here with GAD PAL Nonce lib

Xcode 15.3 and iOS 17.4 generate a CPU spike when launching the app
 
 
Q