August 26th, 2012

Mdworker and high CPU usage

Ever since last year when I upgraded to Mac OS X Lion I had noticed that a process called “mdworker” was constantly eating up about 80-100% of my CPU. After some googling I learned that mdworker is part of spotlight’s indexing service and that others have experienced the same issue as me. Unfortunately it appeared that no one has found a solution; the only way to stop mdworker is to disable spotlight. I use spotlight on a daily basis to launch all my apps using Command key+space bar, so disabling spotlight was not something I wanted to do. So I toughed it out, getting even more frustrated as every day my MacBook Pro would randomly grind to a halt as mdworker chugged away, gobbling up as much CPU as possible.

Then, when Apple released Mountain Lion I hope and prayed that this issue would be resolved, but, to my dismay the problem was still there. Suddenly, I remembered the Mac OS X Console.app; Console allows you to view logs of all the events, services, and processes your Mac is doing and it will tell you of any errors. Sure enough there were many listings for mdworker, such as this one:

"2012-08-26 2:14:29.282 PM mdworker[18375]: (Normal) Import: pre-ls-info uti:dyn.ah62d4qmuhk2x43xtr34hq2pzrv4a plugin:internalPlainTextImporter exceeded cpu use limits (12) after 40216 milliseconds - find suspect file using: sudo mdutil -t 371363"

Most of that means nothing to me but I found it comforting that my Mac and I agreed that mdworker has been exceeding CPU usage limits. Then I noticed “find suspect file using: sudo mdutil -t 371363” Perhaps mdworker is stuck on a file and this is the cause of my frustration? So I opened terminal and typed the command “sudo mdutil -t 371363” (no quotes) and sure enough the culprit was Suitcase Fusion.fontvault! I checked all the other logs for mdworker and it told me the same thing; spotlight was having a hell of a time indexing my Suitcase Fusion font vault.

The solution

Exclude the Suitcase Fusion’s font vault folder from Spotlight’s indexing. I keep my font vault database in a folder within my Documents folder, but the default location is /Library/Extensis/Suitcase Fusion/Suitcase Fusion.fontvault. In Lion/Mountain Lion the Library folder is unnecessarily hidden so first you will need to make it visible.

  1. Open Terminal.app and type:
    chflags nohidden /Users/USERNAME/Library
    replace USERNAME with your user name.
  2. Open System Preferences > Spotlight, then under the Privacy tab add /Library/Extensis/Suitcase Fusion/ to the exclude list

After making this change mdworker quieted down and returned to normal operations and my MBP has been runny happily. What a relief!

8 comments on “Mdworker and high CPU usage

  1. Having similar issue with Mail.app and mdimport but with .emlx files. The files do not appear to be in the correct format as other ‘normal’ .emlx files. Cant seem to use this technique as I will need the email indexed. Seems there is a serious bug in mdimporter if it can read the file format as expected. Files appear to be partial MD5/Base64 sections of mail messages not normal .emlx files.

    8/10/12 12:45:22.458 AM mdworker[2510]: (Normal) Import: import uti:com.apple.mail.emlx plugin:/Library/Spotlight/Mail.mdimporter exceeded cpu use limits (12) after 24002 milliseconds – find suspect file using: sudo mdutil -t 2418248

    The only Mail.mdimporter appears to be at /System/Library/Spotlight/Mail.mdimporter

    Reply
    1. Seems like you’re having a much more serious issue than what others are having. Some are suggesting that the issue is due to a failing storage device. The only troubleshooting I can think of is to run Disk Utility and check the hard drive for errors and repair permissions. Or perhaps there is a mail plugin that you’re using?

      I’m not sure if this would be of any help: https://discussions.apple.com/thread/4408278?start=0&tstart=0

      If you’ve solved the issue please post the solution in case others are having the same problem.

      Reply
  2. You are a genius. I am so glad you posted in the Linked In group tonight because I just did a re-install of my Extensis Suitcase today. You’ve allowed me to circumvent an issue before it started. Cheers! Also, your site is super nice. Really excellent work.

    Reply
  3. Hello, which was the command that you wrote to get the log? I used “syslog” and “fs_usage -w -f filesys mdworker” and I still can’t find why the mdworker is eating up 100% of my CPU and overheating my Mac. Thanks!

    Reply
    1. Hi Neto,

      Try checking your Mac OS X Console (in Applications/Utilities/) and search for entries related to Mdworker. One of the errors in my log mentioned that mdworker was having problems with a file and suggested that I use the terminal command “sudo mdutil -t 371363” to find out which file is causing problems. For me, the problem was my Suitcase library, it could be a different file for yourself, but the logs in your Console may shed some light on things.

      Let me know if that helps.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *