Sonoma extremely slow / hangs opening folders in ~/Library/Containers

My app iterates over all folders on disk and queries metadata of each folder.

After Sonoma was released, a bunch of users (but not all) complained that the app has become very slow or stalls indefinitely while performing the scan.

I have narrowed down that the delay occurs in POSIX open() function, and the folders it stalls on are folders inside ~/Library/Containers and ~/Library/Group Containers, which store data of sandboxed apps.

My app is not sandboxed itself, and the problem doesn't happen on all Macs, only on a subset of Macs.

I read it in WWDC transcripts that in macOS Sonoma, Apple has introduced additional privacy access control to these particular folders, and my guess is that the delays and stalling are related to this new macOS feature.

Is anyone else is experiencing this problem? Can I do something to work around this problem? Or is this a bug of macOS Sonoma and I should report it to Apple?

Replies

my guess is that the delays and stalling are related to this new macOS feature.

That seems likely.

Usually these accesses trigger a TCC alert but I suspect that something about the context in which you’re making them prevents that alert from showing up.

I’m not sure there’s a good path forward here. This new protection is specifically designed to stop you from doing what you’re doing. Even if the TCC alert were showing up and the user approved that access, it’s only granted for the lifetime of your process. The next time your process runs, the user will see the alert again.

For the moment I recommend that you just skip these container directories. In the long term, my only suggestion is that you file a bug explaining how this change is affecting your product and requesting some way for the user to permanently grant you this access.

If you do file a bug, please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"