Monday, April 13, 2009

Safari uses CPU 100% - corrupt SafeBrowsing.db

On 2 of my OSX (10.4 and 10.5) machines, Safari started consuming 100% CPU. After a bit of research it seemed that it was the new Safe Browsing feature introduced in 3.2(?). Basically with the feature "Warn when visiting a fraudulent website" after 2 minutes Safari would ramp the CPU to 100% and it would stay there, for ever if you left it. Then when you tried to quit it would crash.


I tried a different account, and found that other accounts on the same machine didn't have this problem.

Then I used Activity Monitor while Safari ramped to 100% to see what Safari was doing. In Activity Monitor, click on Safari, then get-info, click on 'Open Files and Ports'


and copy and paste into a text file. Reading through I see

    /Users/name/Library/Caches/com.apple.Safari/SafeBrowsing.db


so the next step was to force quit Safari, and rename this file

    cd /Users/name/Library/Caches/com.apple.Safari

    mv SafeBrowsing.db SafeBrowsing.db.old

restart Safari, and this file gets recreated. Safari does ramp the CPU but after a minute or so its back to normal.

BTW this file is created by Safari downloading from safebrowsing.clients.google.com, so you should ensure access to that hostname.

12 comments:

Anonymous said...

Thanks! This solved my problem.

QuiteTall said...

glad it helped!

Doug Clinton said...

Thanks very much, that solved the problem for me, too.

BTW, the SafeBrowsing.db wasn't in the Library folder shown in your post on my machine. Instead I tracked it down to /private/var/folders/Uu/UuJyAhmfFcOpPvLzlS+BpE+++TI/-Caches-/com.apple.Safari which will obviously vary from system to system so if you're having this problem and can't find the file, it may be under /private/var/folders instead.

QuiteTall said...

Interesting.... what version of Safari do you have?

Anonymous said...

wow thanks!
This solved my problem.
The same has happend to me, with Opera 4.0.3 running on MS Windows.
Must be some SQLite Error I guess.

Anonymous said...

Wow 35 mins of searching forums for answers and you FINALLY solved my problem. Thanks.

QuiteTall said...

no problem... maybe my solution will get higher in the Google search rankings :-)

THATGuyEd said...

To all...

/private/var/folders/JF/JFO03PYjEPW4bgiq4jxwm++++TI/-Caches-/com.apple.Safari was the path on my system and SafeBrowsing.db(.old) was the culprit.

Thanks to all (^_^)

DSF said...

My computer has been frequently entering into sleep mode and the only thing I can see is that my CPU is always at 100% (mainly due to Safari). I've adjusted the file as you've said and it has certainly brought the level down. hopefully this has sorted out the issue

thanks :)

The Specialist said...

Same problem here, youre fix worked great! even with safari 5.1.3. and osx 10.7.3.
Thanks!

Stuart Grandin said...

https://discussions.apple.com/message/23685234?tstart=0#23685234

Hope this helps you!!

Stuart

Mike said...


This really helped me. i took a blunter approach - i deleted the whole com.apple.safari folder and then relaunched. the folder was rebuilt and the issue went away.

Thanks!

mike