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

Feb 14, 2020 6:15 PM in response to BDAqua

It took me a while to confirm this, but yes, it runs full out in Safe Boot mode as well. (It takes a while before it runs amok, so I had to let it sit for a bit in Safe Mode to confirm this.)


Also yes, as I mentioned in my original post, I tried all kinds of things. Turned off calendars, logged out of iCloud and back in (restarted in between), and so on. Nothing seems to fix it.

Mar 26, 2020 4:44 AM in response to Grant Bennet-Alder

I had a perpetual "Spinning Wheel" problem for several Mac releases that was only resolved when I installed BitDefender and it found a couple of trojan horse viruses lurking in some old folders. But since then my Mac will freeze occasionally as BD takes 90% of a cpu to perform some function. So I plan to remove it. (And btw, using virus software from a Russian company has always made me a bit queasy...)


But I have two remaining concerns about viruses:

  1. Re: John Galt's assertion that there are *no* Mac viruses out there - is this really true? What about ransomware that hijacks your Photos folder? I have to think that some Mac users have fallen victim to that extortion.
  2. There is a VERY real issue on the Mac with Outlook-based viruses. Twice in the past month I've been victimized by an Outlook virus that sends itself to everyone in my Inbox (900+ last count) with a bogus email suggesting they review an attached pdf. The first time I inadvertently clicked on an attachment. The second time I most assuredly did not. (I can't figure out if it left a timer behind to try again after a month.)
    • This virus added a rule to Outlook to mark all my incoming mail as Read and moved it to the Trash to give it some time to send itself in repeated waves without my noticing bounces or authentic replies. It even spoofed my email address and responded affirmatively to those who responded asking if the email was genuine. Not so pathetic anymore.
    • BitDefender missed this virus entirely. GoDaddy suggested I install ProofPoint to guard against any future attacks, which I purchased.


What about that rare-but-deadly occasion where you slip?


[Edited by Moderator]

Mar 29, 2020 4:57 AM in response to Grant Bennet-Alder

OK, I removed BitDefender. No change to CalendarAgent and Photoanalysisd - still constantly running at ~60% and 40% respectively.


Did a little more research and found a reference to Google Calendars causing this issue. I unsynched an old one and it dropped the respective utilizations to 53% and 33%, so there might be something to this possibility.


I also have another old unused Exchange account from a company I have since left that is still checked. But I don't want to lose the calendar items on my Mac. If I uncheck in Internet Accounts, will the Mac retain the local copy?


Finally I have one business Google Calendar that I only use through Outlook. If I uncheck it in System Preferences/Internet Accounts, will it still work through Outlook?

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.