YouTube random crash, audio keeps repeating a given sound. Unable to do anything except force shut down by holding power button

Update 01/05/2019 :
Switching to Intel and removing Nvidia caused the computer to not freeze for more than 3 days, but unfortunately it again froze two times today. I used @jackw11111 advice, and managed to take a picture of the memory usage through the Terminal when it froze the second time. enter image description here

What I find strange is that not all the RAM was used when it froze.

Update 23/04/2019 :
Upgrading to 18.10 did not solve the issue. The freezing happened again several times in both Firefox and Google Chrome, as well as in Opera. The last time it happened, I was on the Google Maps website. Strangely, the freezing seems to occur even more than before. It became so disturbing that I only use Ubuntu for offline work, and OS X for the rest.

Any suggestion would be appreciated.

Update 31/03/2019 :
Unfortunately it happened again yesterday and today, even after I disabled hardware acceleration and installed the Nvidia graphic driver. For now, it happened only in Firefox, but that is maybe because I mostly used Firefox. And I cannot open the terminal through the shortcut (Alt+Ctrl+T) during the freezing, even though it otherwise works.

I made a video showing the problem: https://www.youtube.com/watch?v=YZrK1bsnHCo
Yesterday, the freezing in Firefox even happened while I was not watching a video at all, but simply scrolling through the browser search results.



I installed Ubuntu 18.04.2 LTS on my MacBookPro two weeks ago. From time to time (at least once a day generally), while watching a YouTube video, the entire screen freezes, except the audio which keeps looping the sound being played at the time of the crash (like "shshshshshshshsh" or "stustustu" or "vidvidvidvid" I hope you see what I mean). The only thing I can do is force shut down the computer by pressing and holding down the power button for a few seconds.

I have absolutely no idea where this comes from. It happens both on Firefox and Chrome.

Do you have any idea what it could be, how I could prevent that or if there is at least another way to simply force quit YouTube/ Firefox / Chrome (without shutting down the entire computer by pressing the power button a few seconds) and simply restart the browser even though all shortcuts I tried as well as mouse movements did not respond during the crash?

Thanks for your help !


For Aravind:

$ hwinfo --gfxcard
14: PCI 100.0: 0300 VGA compatible controller (VGA)         
  [Created at pci.378]
  Unique ID: VCu0.9RMFrOT84MB
  Parent ID: vSkL.jPq0IMUQb1A
  SysFS ID: /devices/pci0000:00/0000:00:01.0/0000:01:00.0
  SysFS BusID: 0000:01:00.0
  Hardware Class: graphics card
  Model: "nVidia GK107M [GeForce GT 650M Mac Edition]"
  Vendor: pci 0x10de "nVidia Corporation"
  Device: pci 0x0fd5 "GK107M [GeForce GT 650M Mac Edition]"
  SubVendor: pci 0x106b "Apple Inc."
  SubDevice: pci 0x00fc 
  Revision: 0xa1
  Driver: "nouveau"
  Driver Modules: "nouveau"
  Memory Range: 0xc0000000-0xc0ffffff (rw,non-prefetchable)
  Memory Range: 0x90000000-0x9fffffff (ro,non-prefetchable)
  Memory Range: 0xa0000000-0xa1ffffff (ro,non-prefetchable)
  I/O Ports: 0x2000-0x207f (rw)
  Memory Range: 0xc1000000-0xc107ffff (ro,non-prefetchable,disabled)
  IRQ: 47 (557954 events)
  Module Alias: "pci:v000010DEd00000FD5sv0000106Bsd000000FCbc03sc00i00"
  Driver Info #0:
    Driver Status: nvidiafb is not active
    Driver Activation Cmd: "modprobe nvidiafb"
  Driver Info #1:
    Driver Status: nouveau is active
    Driver Activation Cmd: "modprobe nouveau"
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #12 (PCI bridge)

31: PCI 02.0: 0300 VGA compatible controller (VGA)
  [Created at pci.378]
  Unique ID: _Znp.RpDAoKcUWbF
  SysFS ID: /devices/pci0000:00/0000:00:02.0
  SysFS BusID: 0000:00:02.0
  Hardware Class: graphics card
  Model: "Intel 3rd Gen Core processor Graphics Controller"
  Vendor: pci 0x8086 "Intel Corporation"
  Device: pci 0x0166 "3rd Gen Core processor Graphics Controller"
  SubVendor: pci 0x106b "Apple Inc."
  SubDevice: pci 0x00fb
  Revision: 0x09
  Driver: "i915"
  Driver Modules: "i915"
  Memory Range: 0xc1400000-0xc17fffff (rw,non-prefetchable)
  Memory Range: 0xb0000000-0xbfffffff (ro,non-prefetchable)
  I/O Ports: 0x3000-0x303f (rw)
  IRQ: 46 (243 events)
  Module Alias: "pci:v00008086d00000166sv0000106Bsd000000FBbc03sc00i00"
  Driver Info #0:
    Driver Status: i915 is active
    Driver Activation Cmd: "modprobe i915"
  Config Status: cfg=new, avail=yes, need=no, active=unknown

Primary display adapter: #14

$ sudo journalctl -r -p err
-- Logs begin at Fri 2019-03-15 00:04:59 CET, end at Fri 2019-03-29 15:09:01 CET
Mär 29 13:19:35 frieder-MacBookPro kernel: nouveau 0000:01:00.0: msvld: init fai
Mär 29 13:19:35 frieder-MacBookPro kernel: nouveau 0000:01:00.0: msvld: unable t
Mär 29 13:18:17 frieder-MacBookPro bluetoothd[885]: Failed to set mode: Blocked 
Mär 29 13:18:17 frieder-MacBookPro spice-vdagent[1650]: Cannot access vdagent vi
Mär 29 13:18:16 frieder-MacBookPro pulseaudio[1502]: [pulseaudio] backend-ofono.
Mär 29 13:18:10 frieder-MacBookPro kernel: nouveau 0000:01:00.0: gr: DATA_ERROR 
Mär 29 13:18:10 frieder-MacBookPro kernel: nouveau 0000:01:00.0: gr: DATA_ERROR 
Mär 29 13:18:10 frieder-MacBookPro kernel: nouveau 0000:01:00.0: gr: DATA_ERROR 
Mär 29 13:18:10 frieder-MacBookPro kernel: nouveau 0000:01:00.0: gr: DATA_ERROR 
Mär 29 13:18:10 frieder-MacBookPro kernel: nouveau 0000:01:00.0: gr: DATA_ERROR 
Mär 29 13:18:10 frieder-MacBookPro kernel: nouveau 0000:01:00.0: gr: DATA_ERROR 
Mär 29 13:18:10 frieder-MacBookPro kernel: nouveau 0000:01:00.0: gr: DATA_ERROR 
Mär 29 13:18:10 frieder-MacBookPro kernel: nouveau 0000:01:00.0: gr: DATA_ERROR 
Mär 29 13:18:10 frieder-MacBookPro kernel: nouveau 0000:01:00.0: gr: DATA_ERROR 
Mär 29 13:18:10 frieder-MacBookPro kernel: nouveau 0000:01:00.0: gr: DATA_ERROR 
Mär 29 13:18:10 frieder-MacBookPro kernel: nouveau 0000:01:00.0: gr: DATA_ERROR 
Mär 29 13:18:10 frieder-MacBookPro kernel: nouveau 0000:01:00.0: gr: DATA_ERROR 
Mär 29 13:18:10 frieder-MacBookPro kernel: nouveau 0000:01:00.0: gr: DATA_ERROR 
Mär 29 13:18:10 frieder-MacBookPro kernel: nouveau 0000:01:00.0: gr: DATA_ERROR 
Mär 29 13:18:10 frieder-MacBookPro kernel: nouveau 0000:01:00.0: gr: DATA_ERROR 
Mär 29 13:18:10 frieder-MacBookPro kernel: nouveau 0000:01:00.0: gr: DATA_ERROR 
Mär 29 13:18:10 frieder-MacBookPro kernel: nouveau 0000:01:00.0: gr: DATA_ERROR 
lines 1-23


dmesg gives really a lot of text. Much of it is DATA_ERROR but it's way too much to copy-paste it here.

I'm not really into MacBooks honestly, but once I had very similar problem to yours. After a week of investigation it turned out to be a problem with CPU (it was intel i5 Haswell series, can't remember its number). The solution was to disable turbo boost in BIOS. This might not be the problem in your case, but what I am saying is that you should not stick to GPU-related investigation. Sometimes such issues turns out to lies somewhere else, like CPU or even audio/motherboard's chipset firmware. You see GPU driver's errors, but their origin may result from something completely different.


Just to give something else to try if it doesn't turn out to be a driver issue...

Perhaps try monitoring your real-time memory usage with the command : watch -n 5 free -m

(You could try right click Terminal window and select Always on Top so that you can see how much free memory you have when it crashes).

Also with the same command, have a look at how large the swap file is. This is slower (hard drive space) memory that is used to free up RAM, only necessary on systems with <3GB RAM, but if your swap memory is 0, and you are getting drops down into <100 MB (possible if you have lots of tabs in browser, IDE open, etc...) then you might need to look into creating a swap file.