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

8 comments:

  1. Thanks! This solved my problem.

    ReplyDelete
  2. 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.

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

    ReplyDelete
  4. 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.

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

    ReplyDelete
  6. 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 (^_^)

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

    ReplyDelete