Spotlight indexing problem solved

Submitted by reeses on Tue, 2005-11-08 14:41. |

http://www.astrogoth.com/~reeses/media/blog/richter_780-1_detail.jpg

In a previous episode, our hero was having trouble with Spotlight. Specifically, for those of you too besotted to remember, mdimport was spiking up to 35% CPU usage every few minutes.

I tried some voodoo, such as reducing the Mail.app IMAP polling frequency, but the problem seemed to persist. I hate CPU meters, but I kept Activity Monitor running, complete with its stupid Dock icon, just so I could catch mdimport in action.

And catch it, I did.

I waited until I saw the CPU usage spike (not that it was really difficult, as it made its presence known by slowing down EVERY app running on the Mac) and ran a simple program: lsof -c mdimport. lsof is one of the fifteen most useful Unix apps I know, along with screen, awk, sed, seq, route, ssh, netcat, e/f/grep, etc. What this did was LiSt every Open File associated with the (-c)ommand "mdimport". Over several iterations, I noticed that the AddressBook.data file was constantly being accessed. This made sense, because maybe it updates entries every time a mail is received. Who knows.

The other frequent entries were a few .DS_Store files on one of my external drives. Specifically, .DS_Store files in directories I had either backed up or copied from my PowerBook HD onto the external drive to save space on the laptop and avoid fragmentation.

Apparently, mdimport was puking on these files. I didn't have the foresight to check the obvious -- that maybe they had an m/c/atime in the future, although it's impossible that mdimport relies upon them. If it did, indexing your hard drive would be like painting the Golden Gate Bridge -- just as it finished traversing the directory hierarchies, it would have to start over.

Regardless of the problem, I just deleted the .DS_Store files that were showing up. They weren't important, as I don't customise my folder views much beyond "show me column view for this one, show me thumbnails for this one."

Boom, problem solved. No more 35% mdimport spikes. Now I have the usual pain, like iTerm taking up too much CPU when scrolling text, but it has tabs, I can tab away from the updating window, and the usage goes down. At least I don't have evil background apps clawing away at me.

Oh, and one fool asked today why I never put up a feed for my blog. It's right here doofball. It's also right over there in the navbar.

Post new comment

Captcha Image: you will need to recognize the text in it.
Please type in the letters/numbers that are shown in the image above.