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?