Jim's Depository

this code is not yet written

OS X will sometimes hang for 10+ seconds, frequently earning you the dread beachball. Anything that causes the program’s main thread to stop processing events will earn you a beachball, but I can suggest two:

First the easily explainable: Your hard drive might be failing. Hard drives generally fail slowly. They start detecting problematic sectors and rewrite them to good sectors and continue on their merry way. Eventually they might have to try many times to recover the data, during this time the drive is unavailable to your computer and any program that tries to access it will get a beach ball until the drive either successfully remaps the sector or gives up. Disk drives have a thing called S.M.A.R.T. which lets the computer track how the drive is failing. Do not be deceived by Disk Utility’s claims that your S.M.A.R.T. status is good. I’ve had two notebook drives failing miserably, with unrecoverable sectors (lost data) and Disk Utility was perfectly happy. Get something like Apple - Downloads - System/Disk Utilities - SMART Utility and use it. Some drives report strangely. You might have a false positive.

Second and bordering on witchcraft: If you look in your /var/log/system.log and see lines with INSERT-HANG-DETECTED you might do a tail -f /var/log/system.log and see if it correlates with your hangs. I had that on a desktop and a laptop. Now, for the strange page… Safari is tracking your web browsing and keeping images of the web sites you visit, even if you clear your caches and history. As part of Top Sites there is a directory of screen shots from web sites you visit. Not finding a GUI way to clear those, I did a rm Library/Caches/com.apple.Safari/Webpage Previews/*.png and a rm Library/Caches/com.apple.Safari/Webpage Previews/*.jpeg – on both machines my random freezes stopped. I can only posit two explanations, neither of which sounds very good. It is possible that one of the images in there is corrupt in such a way that it takes a long time to parse, and Safari parses it frequently. The other is that beyond a certain size, that directory causes terrible performance in some frequent algorithm.

Further thoughts on INSERT-QUEUE-HANG…

The error text comes from the CFNetwork framework. The question, is what is it inserting into or querying? Some sort of cache seems reasonable.

I read through the latest CFNetwork sources Apple has made available on their open source server, but these are pretty old (10.4?) and don't have these tests in them.

But at least it's a pointer.