This has been an issue I have experienced since Ubuntu 14.04. I have attempted a number of fixes (lost track as I've literally tried 20+) all to no avail. It's completely random when it happens and I can't exactly place what is triggering it. I could simply be surfing the web in Chrome or Firefox, or I could be doing an Android build and it will freeze.
Each time it happens, I have no keyboard or mouse functionality so I can't try to kill processes.
I have seen this on a few different hardware configurations, but they each have AMD processors and chipsets in common.
Machines were all stock voltages and speeds. No over clocking involved.
First machine specs: AMD Phenom II x6 1090t 3.2GHz Gigabyte GA-870-UD3 motherboard (AMD 870 chipset) 16GB Kingston HyperX DDR3 1600MHz Samsung 840 Pro Series 250GB SSD Nvidia GT240 1GB PCI-e
Second machine specs: AMD FX 8320 3.5GHz Gigabyte GA-970A-UD3 motherboard (AMD 970 chipset) 16GB Kingston HyperX DDR3 1600MHz Samsung 840 Pro Series 250GB SSD AMD 7770 1GB PCI-e (also had Nvidia GTX 660 2GB in this configuration)
Now these specs do share some common parts. However, when I was using Ubuntu 17.10 it happened, but using Ubuntu Gnome 17.10 these freezes absolutely do not happen. I believe it to be something with Unity, but I'm at a loss as to where to start trying to track down causes.
Any help would be appreciated.