Sandbox violations by MacOS-native-services (Family, imagent and searchpartyuseragent) leading to diagnostic runs and contactsd hogging resources
(This is a duplicate of Understanding Sandbox Violations f… | Apple Developer Forums over in the developer forums, but I was asked to move it here. This post also has some overlap with macOS Ventura "Family" app persistent sto… - Apple Community in the Ventura forums)
I have encountered an issue where several (all?) of my Macbooks get into a sandbox violation situation (I assume). Below is in excerpt from logs focusing just on the sandbox violation. The errors are surrounded by XPC failures and errors.
error 23:23:21.382263+0100 kernel Sandbox: Family(1316) deny(1) mach-lookup com.apple.contactsd.persistence
error 23:23:24.385962+0100 kernel Sandbox: Family(1316) deny(1) mach-lookup com.apple.contactsd.persistence
error 23:23:27.389910+0100 kernel Sandbox: Family(1316) deny(1) mach-lookup com.apple.contactsd.persistence
error 23:23:36.408940+0100 kernel Sandbox: Family(1316) deny(1) mach-lookup com.apple.contactsd.persistence
error 23:23:45.419593+0100 kernel Sandbox: Family(1316) deny(1) mach-lookup com.apple.contactsd.persistence
error 23:23:54.432109+0100 kernel Sandbox: Family(1316) deny(1) mach-lookup com.apple.contactsd.persistence
The above is just an except, and it seems that Family, imagent and searchpartyuseragent are trying to access com.apple.contactsd.persistance once per second or so and failing (there are also some attempts to reach com.apple.timed.xpc, but an insignificant amount in comparison to com.apple.contactsd.persistance). This in turn causes Diagnostics Reporter to start, and then end hastily almost every ten seconds.
fault 23:23:05.903908+0100 Diagnostics Reporter Invalid launch.
fault 23:23:16.038017+0100 Diagnostics Reporter Invalid launch.
fault 23:23:26.136348+0100 Diagnostics Reporter Invalid launch.
fault 23:23:36.274543+0100 Diagnostics Reporter Invalid launch.
fault 23:23:46.414546+0100 Diagnostics Reporter Invalid launch.
I have no idea how I did this, but I seemed to have messed up sandbox access rights to contacts for some system services?
Contextual information:
- Apple Family functionality is activated, with family members present in iCloud-contacts
- Advanced Data Protection activated
- I have eight (8) accounts added in Contacts; one iCloud, two vanilla CardDAV, and five Google Workspaces. Turning them all off except iCloud does not seem to matter.
Adding some additional information in attached logs. It seems like Family, imagent and searchpartyuseragent each do eight (8) tries to interface via XPC (CoreData: XPC: sendMessage: failed #5 up to #7 starting from #0) and then giving up and initiating a round of Diagnostic reporter after that.
Currently hogging around 2 CPUs each on a M1 Macbook pro (13-inch) and M2 Macbook pro (14-inch). With the M2 Macbook pro booted roughly 24h ago and having slept a quite decent bit of that time, contactsd has consumed more CPU time than WindowServer:
PID USER PRI NI VIRT RES S CPU% MEM% TIME+ ▽Command
728 flindeberg 17 0 389G 117M ? 1.4 0.4 6h11:03 /System/Library/Frameworks/Contacts.framework/Support/contactsd
375 _windowser 17 0 394G 504M ? 20.4 1.5 6h02:55 /System/Library/PrivateFrameworks/SkyLight.framework/Resources/WindowServer -daemon
MacBook Pro (M2 Pro, 2023)