Tom Sheppard

Q: Runaway processes burning CPU & hammering disk

I've filed an official bug report with Apple in mid-April and they requested a sysdiagnose dump, but since then I haven't heard a peep from them and this problem is persistent and very annoying, so I'm turning to the community for help.

 

These four processes have been driving me insane for a couple of months, UserEventAgent, launchd, cfprefsd, mds_stores, all running under root. In that order combined, they use over 230% CPU on my quad-core i7 Mac mini. They always appear together.

 

Worse, cfprefsd is hammering my disk hundreds of times a second creating a temporary file and then renaming it to /private/var/root/Library/Preferences/com.apple.xpc.activity2.plist. I'm talking about writing many GB an hour. The file always contains the same contents. Needless to say, the fan is running full blast and the whole system slows down. This occurs within minutes of rebooting and will sometimes clear on its own after a few hours, and sometimes I just have to reboot. Then it will go away for a day or two before rearing its ugly head again. Wash, rinse, repeat.

 

None of the suggested voodoo I've seen in my searches such as turning off Bluetooth, disabling Safari extensions, rebooting in recovery mode and resetting ACLs, has helped. That includes the advice here: Re: cfprefsd using > 90% of CPU.

 

I even tried disabling /System/Library/UserEventPlugins/com.apple.cts.plugin that someone suggested. It appeared to work, but it disables Time Machine so that "solution" is unacceptable.

 

From logs at the time the event started, it seemed related to the Messages app.

 

2016-04-14 8:12:56.111 PM com.apple.spotlight.IndexAgent[14767]: [com.apple.corespotlight.log] Not allowed to pass in bundle ID

2016-04-14 8:12:56.111 PM soagent[656]: Can't allocate SOHelper <SOMessageHelper: 0x7ffb81f23490> inside com.apple.soagent

2016-04-14 8:12:56.111 PM IMDPersistenceAgent[679]: [com.apple.corespotlight.log.index] Finished "index items"(62) with error:Error Domain=CSIndexErrorDomain Code=-1003 "(null)"

2016-04-14 8:12:56.111 PM IMDPersistenceAgent[679]: [Warning] IMDChatAddMessageToSpotlight: indexing searchable items failed with error Error Domain=CSIndexErrorDomain Code=-1003 "(null)"

2016-04-14 8:12:56.111 PM IMDPersistenceAgent[679]: [Warning] IMDChatAddMessageToSpotlight: indexing searchable items failed with error Error Domain=CSIndexErrorDomain Code=-1003 "(null)"

2016-04-14 8:12:56.113 PM com.apple.spotlight.IndexAgent[14767]: [com.apple.corespotlight.log] Not allowed to pass in bundle ID

2016-04-14 8:12:56.113 PM IMDPersistenceAgent[679]: [com.apple.corespotlight.log.index] Finished "index items"(64) with error:Error Domain=CSIndexErrorDomain Code=-1003 "(null)"

2016-04-14 8:12:56.113 PM IMDPersistenceAgent[679]: [Warning] IMDChatAddMessageToSpotlight: deleting message for searchable items failed with error Error Domain=CSIndexErrorDomain Code=-1003 "(null)"

2016-04-14 8:12:56.113 PM IMDPersistenceAgent[679]: [Warning] IMDChatAddMessageToSpotlight: deleting message for searchable items failed with error Error Domain=CSIndexErrorDomain Code=-1003 "(null)"

2016-04-14 8:13:03.890 PM com.apple.CDScheduler[63]: *** LOG MESSAGE QUOTA EXCEEDED - SOME MESSAGES FROM THIS PROCESS HAVE BEEN DISCARDED ***

 

Clearing out the ~/Library/Messages folder and rebooting seemed to help, but that is temporary at best because, even without the Messages app running, the incoming messages still recreate the database there. I'm currently running without Messages launched and yet I'm in the middle of an event as I write this. Is it related? Who knows? Even if I could totally disable Messages, I don't want to.

 

Today, nothing I try seems to help. There you have it gurus. What can I try now?

Mac mini, OS X Mavericks (10.9.4), 2.6 GHz i7, 16 GB RAM; 1 TB Fusion

Posted on May 23, 2016 2:28 PM

Close

Q: Runaway processes burning CPU & hammering disk

  • All replies
  • Helpful answers

Previous Page 2
  • by Linc Davis,

    Linc Davis Linc Davis Jun 9, 2016 1:05 PM in response to Tom Sheppard
    Level 10 (207,926 points)
    Applications
    Jun 9, 2016 1:05 PM in response to Tom Sheppard

    1. This procedure is a diagnostic test. It changes nothing, for better or worse, and therefore will not, in itself, solve the problem. But with the aid of the test results, the solution may take a few minutes, instead of hours or days.

    The test works on OS X 10.8 ("Mountain Lion") and later. I don't recommend running it on older versions of OS X. It will do no harm, but it won't do much good either.

    Don't be put off by the complexity of these instructions. The procedure is easy to do right, but it's also easy to do wrong, so I've made the instructions very detailed. You do harder tasks with the computer all the time.

    2. If you don't already have a current backup, please back up all data before doing anything else. The backup is necessary on general principle, not because of anything in the test procedure. Backup is always a must, and when you're having any kind of trouble with the computer, you may be at higher than usual risk of losing data, whether you follow these instructions or not.

    There are ways to back up a computer that isn't fully functional. Ask if you need guidance.

    3. Below are instructions to run a UNIX shell script, a type of program. As I wrote above, it changes nothing. It doesn't send or receive any data on the network. All it does is to generate a human-readable report on the state of the computer. That report goes nowhere unless you choose to share it. If you prefer, you can act on it yourself without disclosing the contents to me or anyone else.

    You should be wondering whether you can believe me, and whether it's safe to run a program at the behest of a stranger. In general, no, it's not safe and I don't encourage it.

    In this case, however, there are ways for you to decide whether the program is safe without having to trust me. First, you can read it. Unlike an application that you download and click to run, it's transparent, so anyone who understands the code can verify what it does.

    You may not be able to understand the script yourself. But variations of it have been posted on this website many times over a period of years. Any one of the millions of registered users could have read the script and raised the alarm if it was harmful. Then I would not be here now and you would not be reading this message. See, for example, this discussion.

    Nevertheless, if you can't satisfy yourself that these instructions are safe, don't follow them. Ask for other options.

    4. Here's a general summary of what you need to do, if you choose to proceed:

    ☞ Copy the text of a particular web page (not this one) to the Clipboard.

    ☞ Paste into the window of another application.

    ☞ Wait for the test to run. It usually takes a few minutes.

    ☞ Paste the results, which will have been copied automatically, back into a reply on this page.

    These are not specific instructions; just an overview. The details are in parts 7 and 8 of this comment. The sequence is: copy, paste, wait, paste again. You don't need to copy a second time.

    5. Try to test under conditions that reproduce the problem, as far as possible. For example, if the computer is intermittently slow, run the test during a slowdown.

    You may have started up in safe mode. If the system is now in safe mode and works well enough in normal mode to run the test, restart as usual before running it. If you can only test in safe mode, do that.

    6. If you have more than one user, and only one user is affected by the problem,, and the affected user is not an administrator, then please run the test twice: once while logged in as the affected user, and once as an administrator. The results may be different. The user that is created automatically on a new computer when you start it for the first time is an administrator. If you can't log in as an administrator, test as the affected user. Most personal Macs have only one user, and in that case this section doesn’t apply. Don't log in as root.

    7. Load this linked web page (on the website "Pastebin") in Safari. Press the key combination command-A to select all the text, then copy it to the Clipboard by pressing command-C.

    8. Launch the built-in Terminal application in any one of the following ways:

    ☞ Enter the first few letters of its name ("Terminal") into a Spotlight search. Select it in the results (it should be at the top.)

    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.

    ☞ Open LaunchPad and start typing the name.

    Click anywhere in the Terminal window to activate it. Paste from the Clipboard into the window by pressing command-V, then press return. The text you pasted should vanish immediately.

    9. If you're logged in as an administrator, you'll be prompted for your login password. Nothing will be displayed when you type it. You will not see the usual dots in place of typed characters. Make sure caps lock is off. Type carefully and then press return. You may get a one-time warning to be careful. If you make three failed attempts to enter the password, the test will run anyway, but it will produce less information. If you don't know the password, or if you prefer not to enter it, just press return three times at the password prompt. Again, the script will still run.

    If the test is taking much longer than usual to run because the computer is very slow, you might be prompted for your password a second time. The authorization that you grant by entering it expires automatically after five minutes.

    If you're not logged in as an administrator, you won't be prompted for a password. The test will still run. It just won't do anything that requires administrator privileges.

    10. The test may take a few minutes to run, depending on how many files you have and the speed of the computer. A computer that's abnormally slow may take longer to run the test. While it's running, a series of lines will appear in the Terminal window like this:

        Test started
            Part 1 of 4 done at: … sec
            …
            Part 4 of 4 done at: … sec
        The test results are on the Clipboard.
        Please close this window.

    The intervals between parts won't be exactly equal, but they give a rough indication of progress.

    Wait for the final message "Please close this window" to appear—again, usually within a few minutes. If you don't see that message within about 30 minutes, the test probably won't complete in a reasonable time. In that case, press the key combination control-C or command-period to stop it. Then go to the next step. You'll have incomplete results, but still something.

    In order to get results, the test must either be allowed to complete or else manually stopped as above. If you close the Terminal window while the test is still running, the partial results won't be saved.

    11. When the test is complete, or if you stopped it manually, quit Terminal. The results will have been saved to the Clipboard automatically. They are not shown in the Terminal window. Please don't copy anything from there. All you have to do is start a reply to this comment and then paste by pressing command-V again.

    At the top of the results, there will be a line that begins with the words "Start time." If you don't see that, but instead see a mass of gibberish, you didn't wait for the "close this window" message. Please wait for it and try again.

    If any private information, such as your name or email address, appears in the results, anonymize it before posting. Usually that won't be necessary.

    12. When you post the results, you might see an error message on the web page: "You have included content in your post that is not permitted," or "The message contains invalid characters." That's a bug in the software that runs this website. Please post the test results on Pastebin, then post a link here to the page you created.

    If you have an account on Pastebin, please don't select Private from the Paste Exposure menu on the page, because then no one but you will be able to see it.

    13. When you're done with the test, it's gone. There is nothing to uninstall or clean up.

    14. This is a public forum, and others may give you advice based on the results of the test. They speak for themselves, not for me. The test itself is harmless, but whatever else you do may not be. For others who choose to run it, I don't recommend that you post the test results on this website unless I asked you to.

    15. The linked UNIX shell script bears a notice of copyright. Readers of ASC may copy it for their own personal use. Neither the whole nor any part may be redistributed.

  • by eVoodoo,Helpful

    eVoodoo eVoodoo Jul 12, 2016 10:58 AM in response to Tom Sheppard
    Level 1 (9 points)
    Desktops
    Jul 12, 2016 10:58 AM in response to Tom Sheppard

    Hi Tom,

     

    I came across this thread while looking for fix to the same problem you describe. The process cfprefsd was eating up CPU and writing GBs of data to disk (renaming /private/var/root/Library/Preferences/com.apple.xpc.activity2.plist). I tried a number of things including what I found on this thread. Eventually I decided to wipe my computer and reinstall from scratch. I didn't restore any settings or users, just restored files from a backup. I did that to make sure some setting wasn't being restored that caused this. The issue was happening on 2 Macs, a Mac Mini server and a Mac Pro. My MacBook Pros were not having the issue. I actually rebuilt the Mac Mini from scratch for a different reason, which then seemed to trigger this issue (although it's possible I didn't notice the issue before as I am not on the Mini all that often). The bluetooth issues that others reported got me thinking about what was connected to the computers. The one thing they have in common that the others computers don't is both have an APC UPS connected via USB. All the Macs are on the two UPSs, but only the Mac Pro and Mini are connected via USB for monitoring the UPS to know when to power down.

     

    So here is what seems to have worked for me (This assumes you have a UPS connected via USB to your Mac). Go to Settings > Energy Saver and uncheck the option to show the UPS status in the Menu bar. Next, shut down your Mac and disconnect the USB cable coming from the UPS backup system (You can still leave the power plugged into the UPS, you just can't have the USB cable for monitoring it). Then power up and see if this resolves your issue. For me it's been several days and the issue has not returned. Before this it was occurring everyday within a few minutes to a few hours after a reboot (pretty random on timing). Honestly, I am hesitant to hook the UPS's USB cable back up to prove my theory. I am just so happy not to see cfprefsd hammering my CPU and SSD. If the issue does not return after a couple weeks I will hook it back up to try and replicate the issue. Or maybe even try to replicate this in a VM.

     

    Anyway, hope this helps you or someone else who stumbles across this. It's not a fix as it means disabling the monitoring of the UPS, but it's a workaround for now. If I manage to replicate the issue I will look into contacting Apple to report it.

     

    -Michael

  • by Tom Sheppard,

    Tom Sheppard Tom Sheppard Jun 13, 2016 7:11 AM in response to eVoodoo
    Level 1 (25 points)
    Mac OS X
    Jun 13, 2016 7:11 AM in response to eVoodoo

    Thanks for the idea. I do have an APC UPS connected. Currently, I'm waiting for the problem to return after removing /var/root/ earlier. It takes about a week to come back. When it does, I will definitely give this a try.

     

    Note. Removing /var/root/ has side effects. I have to reregister my copy of Parallels each time, and I think it also throws away the CrashPlan archive encryption key. Since CrashPlan is so badly designed it's hard to tell if this is a result, but it stops backing up without warning you until you exceed your configured warning interval. I don't know what else is stored nested in this folder that is lost. Removing this folder trades one problem for another.

  • by Tom Sheppard,

    Tom Sheppard Tom Sheppard Jun 21, 2016 9:29 PM in response to eVoodoo
    Level 1 (25 points)
    Mac OS X
    Jun 21, 2016 9:29 PM in response to eVoodoo

    It took longer than usual for the problem to return, but return it did. I disconnected the UPS cable tonight and will keep my fingers crossed. I will be giving it at least two weeks before I declare this as a solution, so no news is good news. I'll report back if the problem arises or after about two weeks, whichever is sooner. Thanks again for the tip.

  • by eVoodoo,

    eVoodoo eVoodoo Jun 22, 2016 8:58 PM in response to Tom Sheppard
    Level 1 (9 points)
    Desktops
    Jun 22, 2016 8:58 PM in response to Tom Sheppard

    I didn't see the problem return on either Mac so I decided to plug the USB from the UPS back in to one of them. It took a few hours but now cfprefsd is back hammering the CPU and disk. Didn't need to reboot to see the problem return, but looks like I will need to reboot after unplugging it to stop the process. Killing it doesn't work as it just pops back up and resumes it's punishment. I did try testing this on one of the MacBook Pros, but was only able to test solid for 2 days. I didn't see the problem on that one (might need longer testing). However, the MBP has a battery built in so you don't get the same options in Settings/Energy Saver as you do for a Mac Pro or Mini.

     

    Hope this works for you too. Good luck.

  • by Tom Sheppard,

    Tom Sheppard Tom Sheppard Jul 12, 2016 10:57 AM in response to Tom Sheppard
    Level 1 (25 points)
    Mac OS X
    Jul 12, 2016 10:57 AM in response to Tom Sheppard

    Well, it's been 3 weeks and the problem hasn't returned. Ideally, I should plug the UPS cable back in to see if the problem returns, but I'm content with the fact that the problem is gone. I can live without the UPS cable doing an automatic shutdown. I updated my bug report with Apple, but I hope they were already aware of this problem and will fix it no later than Sierra.

  • by Tom Sheppard,

    Tom Sheppard Tom Sheppard Jul 19, 2016 7:31 AM in response to Tom Sheppard
    Level 1 (25 points)
    Mac OS X
    Jul 19, 2016 7:31 AM in response to Tom Sheppard

    Apple updated my bug report after closing it and said,

    the issue was resolved in macOS 10.12 build 16A221 and higher.

    It's disappointing that they don't push these important fixes to the current OS as this is one nasty bug. Forced upgrade march, I guess.

  • by dowsmith,

    dowsmith dowsmith Sep 11, 2016 3:22 PM in response to eVoodoo
    Level 1 (19 points)
    Mac OS X
    Sep 11, 2016 3:22 PM in response to eVoodoo

    A fantastic piece of detective work...

     

    I was having a torrent of Console errors, and disconnecting the APC USB seems to have fixed it.

     

    Thank you!

Previous Page 2