Websites with heavy use of websockets skyrocket CPU usage in Safari

cpusafari

(Problem reported to Apple Jul 5, 2019 but I got no answer as of Aug 1, 2019)

If you work for Apple please review FB6505912. I have sent to you system reports and Samples from the process.

I am experiencing a very strange bug on Safari. If I leave a webpage that uses websockets heavily, then sleep the system and turn it on back after a couple of minutes, the tab page keeps the CPU at 99.9% all the time, burning down my battery and CPU (it reaches 100ºC). I need to open Activity monitor and kill the page every single day.

This is happening to two websites, firebase.com and g1.com.br.

enter image description here

My system is running MacOS 10.14.6 (18G84) and Safari 12.1.2 (14607.3.9).

It's a MBP 15' i7 2018 with 32Gb of RAM.

I have already cleared the NVRAM and SMC and it didn't solve my problem. I think it's a bug from Safari itself.

Thank you, it's my first post here so let me know if you need more information.

Best Answer

As troubleshooting steps, I'd try the following:

  • Test with another browser to see what happens. If the problem isn't repeated then you're starting to isolate the issue, although I would then try a 3rd browser for good measure to see how it also behaves.
  • Boot into Safe Mode (see below) and test again with Safari

Boot into Safe Mode

Follow these steps to boot your MBP into Safe Mode:

  1. Fully shut down your Mac
  2. Restart your Mac
  3. Immediately press the Shift key and keep it down
  4. Let go of the Shift key when you see the login window (NOTE: If you have FileVault enabled you may need to log in twice).
  5. Take a note of what happens (i.e. visit the sites again with Safari and try to replicate the problem)
  6. Exit Safe Mode by restarting your Mac as normal
  7. Test again when booted normally

Let me know how these steps went and we'll go from there.