Sunday, April 12, 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.

7 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 :-)

 

www.hutsby.net

templates borrowed from here, modified by me - IFTU