Debugging notes-to-self

Stuff I wish I’d known for years (and that the rest of the world probably always knew, just not me):

  1. after your buggy program was slowly eating your memory and swap, and you escaped to a console to kill it using Alt+SysRq+R and then Ctrl+Alt+F1, when you get back to your X-session you can make it grab the keyboard again by typing “kbd_mode -s” in an xterm (found here after trying all sorts of incantations in DuckDuckGo)
  2. if that was on a laptop keyboard with “AltGr dead keys”, the SysRq combo might need to be Fn+SysRq+AltGr+R (yes, try that with one hand!), where AltGr is the right Alt key (found after lots of failed attempts – very frustrating if your swap runs out before you get to the console)
  3. in the end, you wouldn’t typically have needed any of the above if only you’d known that “ulimit -v 1000000” limits any process in your bash shell to 1GB of memory, so that your buggy program will die superquick without locking up the system for 10 minutes (found in no time through a most obvious query – it just took a long time before I thought of looking for it at all…)

%d bloggers like this: