Sunday, July 09, 2017

When resources unavail

Every so often my Linux system starts feeling poorly. Firefox will hang and won't let me close its window. So I ALT-TAB over to my terminal window to kill it.

$ ps -fewww | grep -v grep | grep firefox
bash: fork: retry: Resource temporarily unavailable
bash: fork: retry: Resource temporarily unavailable
bash: fork: retry: Resource temporarily unavailable
bash: fork: retry: Resource temporarily unavailable
bash: fork: Resource temporarily unavailable

When this first happened, I figured I would reboot and that, of course, would fix it. But I couldn't even run shutdown! That's when I thought of this extremely inelegant but useful solution:

$ cd /proc
$ kill *

And that freed up enough of whatever that I could get on with the reboot and then with my life.

When it happened today, I googled around and saw saw solutions suggesting...
  • su root and (WRONG: can't su)
  • ps blah blah and (WRONG: can't ps)
  • ulimit (hmmm... OK I'll try that.)
This particular solution suggests setting NPROC (max user processes) using ulimit -u like so:

$ ulimit -a
...

max user processes              (-u) 2047
...

$ ulimit -u 2100

Upping that value allowed me to kill and restart Firefox without rebooting!!

Thanks, IBM!!

No comments: