I have been experiencing a weird problem in Ubuntu 18.04 and 19.04 (fresh install too), Firefox 64 - 66.0.3 (fresh). I am writing some JavaScript code and checking it in my browser. Sometimes I make mistakes like this:
for(var i = 0; i < 100;){
something_else();
}
that is, infinite loops. Last time it was a new Regex(...).test() with a wrong regex which obviously caused an infinite loop... I should be careful, that's right, but the problem IS:
Does not only my Firefox say something like 'This page is not okay, close it?' but the system itself does not say something like 'This Firefox is not okay, kill it?'
I get a full system freeze without any chance of recovery. All I can do is Alt+SysRq+REIUSB. So debugging my code becomes a problem à la 1978 with multiple reboots, where failing to save the code means losing it. To me it sounds crazy.
I've reinstalled Ubuntu a few times, switched between 18.04 and 19.04, updated the software, all to no avail. The CPU seems to be cool enough, there is no screen blinking, there are no other obvious hardware issues.
UPD: I also ran sudo stress --cpu 4 to check what happens at 100% load. The system does not freeze.
So, the question. What am I doing wrong? Why doesn't my OS or Firefox intercept those freezes?