NSCoreDataCoreSpotlightDelegate Thread Performance Checker issue on iOS 17

Originator:basti.kusserow
Number:rdar://FB13735049 Date Originated:17.04.2024
Status:Open Resolved:
Product:Core Data Product Version:
Classification: Reproducible:Yes
 
Summary: When I run the code from the Apple sample project `Showcase App Data in Spotlight` and add a new photo from my simulator to the app, the thread performance checker reports an issue about `Thread running at User-initiated quality-of-service class waiting on a lower QoS thread running at Background quality-of-service class. Investigate ways to avoid priority inversions`.

Steps to Reproduce: run the app and add an image to the app. (On my real device, the issue even occurred without adding an image).

Expected Result: I would expect that no thread checker issue is reported.

Actual Results: The Thread Performance Checker reports:
```
Thread Performance Checker: Thread running at User-interactive quality-of-service class waiting on a lower QoS thread running at Utility quality-of-service class. Investigate ways to avoid priority inversions
PID: 29446, TID: 9027318
Backtrace
=================================================================
3   CoreData                            0x00000001981ac6e4 8489D8B2-FD76-35AE-B476-45AFD3CBB54C + 87780
4   CoreData                            0x00000001981ab898 8489D8B2-FD76-35AE-B476-45AFD3CBB54C + 84120
5   CoreData                            0x00000001981ab82c 8489D8B2-FD76-35AE-B476-45AFD3CBB54C + 84012
6   CoreData                            0x00000001981ab630 8489D8B2-FD76-35AE-B476-45AFD3CBB54C + 83504
7   CoreData                            0x00000001981ec604 8489D8B2-FD76-35AE-B476-45AFD3CBB54C + 349700
8   CoreData                            0x00000001981ec374 8489D8B2-FD76-35AE-B476-45AFD3CBB54C + 349044
9   CoreData                            0x000000019819d624 8489D8B2-FD76-35AE-B476-45AFD3CBB54C + 26148
10  CoreData                            0x00000001982a18d8 8489D8B2-FD76-35AE-B476-45AFD3CBB54C + 1091800
11  CoreData                            0x00000001981b7838 8489D8B2-FD76-35AE-B476-45AFD3CBB54C + 133176
12  libdispatch.dylib                   0x00000001035e67bc _dispatch_client_callout + 20
13  libdispatch.dylib                   0x00000001035f7e24 _dispatch_lane_barrier_sync_invoke_and_complete + 176
14  CoreData                            0x00000001981b7744 8489D8B2-FD76-35AE-B476-45AFD3CBB54C + 132932
15  CoreData                            0x00000001982a1504 8489D8B2-FD76-35AE-B476-45AFD3CBB54C + 1090820
16  CoreData                            0x00000001981b7838 8489D8B2-FD76-35AE-B476-45AFD3CBB54C + 133176
17  CoreData                            0x00000001981b770c 8489D8B2-FD76-35AE-B476-45AFD3CBB54C + 132876
18  CoreData                            0x00000001982a10d0 8489D8B2-FD76-35AE-B476-45AFD3CBB54C + 1089744
19  CoreData                            0x0000000198216fb8 8489D8B2-FD76-35AE-B476-45AFD3CBB54C + 524216
20  CoreData                            0x0000000198216c94 8489D8B2-FD76-35AE-B476-45AFD3CBB54C + 523412
21  CoreData                            0x00000001981b7838 8489D8B2-FD76-35AE-B476-45AFD3CBB54C + 133176
22  libdispatch.dylib                   0x00000001035e67bc _dispatch_client_callout + 20
23  libdispatch.dylib                   0x00000001035ee66c _dispatch_lane_serial_drain + 832
24  libdispatch.dylib                   0x00000001035ef408 _dispatch_lane_invoke + 408
25  libdispatch.dylib                   0x00000001035fc404 _dispatch_root_queue_drain_deferred_wlh + 328
26  libdispatch.dylib                   0x00000001035fba38 _dispatch_workloop_worker_thread + 444
27  libsystem_pthread.dylib             0x00000001eccc3f2c _pthread_wqthread + 288
28  libsystem_pthread.dylib             0x00000001eccc3fcc start_wqthread + 8
```


Tested on swift versions 5.10, 5.9 and 5.8 on iOS Versions 17.0.1, 17.2 and 17.4 in Xcode 15.3, not fixed
Issue did not occur on iOS 16.4

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!