SafariBookmarksSyncAgent high CPU, RAM, Disk usage on Mac and iPhone
I noticed that on my MacBook Pro M2 (macOS Sonoma) SafariBookmarksSyncAgent demon is constantly running and uses about 95% of CPU, 750Mb of RAM and constantly reads and writes from the disk a lot of data.
I tried turning off Safari syncing with iCloud (System Preferences > Apple ID > iCloud > Show More Apps > Safari), deleting Safari data from iCloud (System Preferences > Apple ID > iCloud > Manage > Safari > Delete from iCloud), restarting the Mac, but it doesn't help. I tried closing all tabs and deleting all bookmarks, restarting the Mac, but that didn't help either.
Through Activity Monitor, I began to look at what files SafariBookmarksSyncAgent opened. I found the file ~/Library/Containers/com.apple.Safari/Data/Library/Safari/SafariTabs.db which was 391Mb in size and deleted it and other SafariTabs.* files.
And this helped, after rebooting the Mac SafariBookmarksSyncAgent began to consume 0% CPU, 40Mb RAM, disk operations became very rare. The new SafariTabs.db file is now about 180 KB in size.
But after I turned on syncing Safari and iCloud the problem returned. SafariTabs.db started to grow and SafariBookmarksSyncAgent started to use 95% of CPU. So I turned off syncing Safari with iCloud and deleted the files SafariTabs.* again.
Same problem on my iPhone, which I found out through the tool Xcode > Instruments > Activity Monitor. And this led to quick battery drain. I solved the problem on iPhone by disabling syncing Safari and iCloud.
How can I solve the problem with SafariBookmarksSyncAgent?
MacBook Pro 14″, macOS 14.1