CalendarAgent running at near 100% CPU, continuously

I recently upgraded to a new Mac Pro and my CalendarAgent daemon is running at close to 100% CPU all the time.


I found various threads suggesting disabling/enabling calendars or logging out of, and back into, my calendar accounts. Any/all of those fixes seem to work temporarily, but within a few hour or after a restart, CalendarAgent is back to running non-stop.


I did a spindump and it appears to be spending almost all of its time in:

[_NSXPCStoreUtilities newSecureArchivedDataWithRootObject:]
[_NSXPCStoreUtilities decodeSecureArchivedData:usingDelegate:classes:]
[NSXPCStoreServer(InternalMethods) handleFaultRequest:inContext:error:]


which leads me to believe that the agent is repeatedly trying to read/store something in its database, failing, and simply doing it again ... and again, and again, and again.


I also used to remember a setting where the calendar would only keep appointments for a limited amount of time (say, a year) before deleting them. That seems to have gone the way of the Dodo because I now have close to a decade of old appointments.


Any suggestions on how to fix this?

Posted on Feb 9, 2020 10:45 AM

Reply
Question marked as Top-ranking reply

Posted on Feb 17, 2020 9:28 PM

So, there's good news and bad(ish) news:


Deciding to take a slash-and-burn approach, I deleted these files from my ~/Library/Calendars folder and restarted:

Calendar Cache

Calendar Cache-shm

Calendar Cache-wal


I did this because (a) they have "cache" in the name so I'm assuming they weren't source data and (b) they were all relatively large and were getting modified all the time.


The good news:


CalendarAgent is no longer running continuously.


The bas(ish) news:


This made all of my calendar events disappear (on the Mac Pro). Turning iCloud synchronization off and back on again doesn't fix it. Enabling and disabling the calendars doesn't fix it. Trying to "refresh" the calendars doesn't fix it. The Calendar app clearly thinks it's in sync with the cloud when it isn't.


But it turns out this is a transient problem. If I add a new appointment from a mobile device, it immediately appears in Calendar. Stranger, if I then delete that appointment, that appointment disappears in Calendar ... and the other events on that day magically reappear.


Since 99% of my calendar use is from mobile devices (iPad, iPhone, Watch) I can live with this as it seems it will eventually get caught up. But it would be nice to know how to reset Calendar's sync state.

20 replies
Question marked as Top-ranking reply

Feb 17, 2020 9:28 PM in response to JamesBucanek

So, there's good news and bad(ish) news:


Deciding to take a slash-and-burn approach, I deleted these files from my ~/Library/Calendars folder and restarted:

Calendar Cache

Calendar Cache-shm

Calendar Cache-wal


I did this because (a) they have "cache" in the name so I'm assuming they weren't source data and (b) they were all relatively large and were getting modified all the time.


The good news:


CalendarAgent is no longer running continuously.


The bas(ish) news:


This made all of my calendar events disappear (on the Mac Pro). Turning iCloud synchronization off and back on again doesn't fix it. Enabling and disabling the calendars doesn't fix it. Trying to "refresh" the calendars doesn't fix it. The Calendar app clearly thinks it's in sync with the cloud when it isn't.


But it turns out this is a transient problem. If I add a new appointment from a mobile device, it immediately appears in Calendar. Stranger, if I then delete that appointment, that appointment disappears in Calendar ... and the other events on that day magically reappear.


Since 99% of my calendar use is from mobile devices (iPad, iPhone, Watch) I can live with this as it seems it will eventually get caught up. But it would be nice to know how to reset Calendar's sync state.

Apr 24, 2020 5:51 AM in response to trebours

Ok, when looking at my Console I have a LOT of logs that pop up from the CalendarAgent and accountsd related to the exchange delegated accounts (about 30 000 in 5min), I can share the files with official Apple support, but won't disclose them here since it would be too difficult to anonymize everything. When I remove all the delegated accounts (but not my own calendars), the CPU drop from 80% to 0.1% and the messages stop.

Mar 22, 2020 10:47 AM in response to BDAqua

Right after upgrading to Catalina, I had CalendarAgent running constantly at 60-70% on a late-2015 iMac with 16 GB memory. I tried:

  • Quitting Apple Calendar: no change
  • Quitting Outlook: no change
  • Force-quitting CalendarAgent: it just came back.


I do have a google Calendar account (synched to Outlook) but I checked to see that it was not active on my Chrome browser.


Then I tried the suggestion from BDAqua to just try unchecking Calendars in iCloud, and CalendarAgent went down to a negligible level.


When I re-checked it, I got a message about merging the calendars with the cloud, which I tried with some trepidation (uh oh, is that going to work or do I get duplicates in the cloud?!?) CalendarAgent ran over 100% while that was happening, but when Apple Calendar seemed to finish, it dropped to 10-15%.


Now ~20 minutes later, CalendarAgent is running at 0.1%, with both Outlook and Apple Calendar open. And my system's performance is pretty snappy!


Let's see if it lasts.

Feb 15, 2020 12:54 PM in response to JamesBucanek

Well, sounds to me like you need to Restore the OS, if it's not some strange hardware problem, but...


EtreCheck is a simple little app to display the important details of your system configuration and allow you to copy that information to the Clipboard. It is meant to be used with Apple Support Communities to help people help you with your Mac.

http://www.etresoft.com/etrecheck


Pastebin is a good place to paste the whole report...

https://pastebin.com/


Or use the paperclip at the bottom of a Reply to attach the full report here. :)


Workable but harder for me to work with...the Note tool on the bottom of this editor's toolbar, as shown in the image, to copy and paste the output from EtreCheck.

Feb 16, 2020 2:03 PM in response to Grant Bennet-Alder

Grant Bennet-Alder wrote:

Calendar agent is tightly intertwined with Contacts and Emails as well. These all depend on databases, that can themselves become corrupted. when that happens, it can get lost analyzing nonsense for a long time.


Agreed. So how do I fix it? Is there a database I can delete or reset? If it's a database, a reinstall won't overwrite it.


By the way, I tried to iosnoop the process to find out what it was read/writing, but SIP wouldn't let me.

Apr 24, 2020 5:41 AM in response to LKHill

I have a somewhat related issue, my CalendarAgent is taking a lot of CPU and a lot of memory (there is clearly a memory leak, it regularly takes up to 10 GB of memory), I'm forced to kill it every day.


I have :

  • deactivated all my calendars from the system preferences;
  • killed the CalendarAgent, and iCal;
  • removed the ~/Library/Calendars folder and the ~/Library/Preferences/com.apple.iCal.plist file;
  • reactivated my calendars from the system preferences;
  • started iCal and waited for it to sync the calendars;
  • reconfigured the delegated accounts (calendars of my colleagues— read only) I have both on GMail and O365 accounts.


Until the last step, it seemed to work perfectly, but once I reactivated the delegated accounts it started to go out of control.


Could someone from Apple look at this, this makes my computer very hard to use, and I'm actually thinking about switch to Outlook for managing my calendars..? This is clearly an abnormal behavior of the CalendarAgent.

Mar 25, 2020 8:52 AM in response to LKHill

Unfortunately after about 24 hours, CalendarAgent returned and has stuck at about 60% of cpu for the past few days. It also seemed to spawn another process, photoanalysisd, running at about 40%.


I spoke to Apple support and we did a Safe Boot (with all the cleanup that it does) but the problem persisted. A senior advisor then told me that it may be due to my recent upgrade to Catalina, and that the processes will just have to go through whatever update they need to do and may then quiesce.


Well it's been three days now, and CalendarAgent has used over 9 ½ hours of cpu time (8x the 1.5 hours for BitDefender) and is still running strong at 60%, along with its little brother photoanalysisd at 40%,. My iMac is still laggy in some apps like Word.


Any other suggestions out there?

Mar 26, 2020 7:31 AM in response to LKHill

The Mac is very well protected against spontaneous attacks.


There is no software that can defend you from Installing things you do not really want on your Mac. MacOS present the web site that was the source of the download, and you must read that information and approve it. There is no substitute for your vigilance.


You DO NOT click on links in emails, under any circumstances. If you need something, you write down the URL and TYPE it into a Browser.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

CalendarAgent running at near 100% CPU, continuously

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.