As a developer you may have many tools watching your project for changes: Your IDE, Webpack, Guard, etc. This is often done with an inotify watcher. If you have too many inotify instances you may run into limits of your operating system.
To find out which process is using them all up you can run:
sudo find /proc/*/fd/ -type l -lname "anon_inode:inotify" -printf "%hinfo/%f\n" | xargs grep -cE "^inotify" | column -t -s:
You will get a list like:
/proc/3753/fdinfo/7 1
/proc/3774/fdinfo/7 1
/proc/4034/fdinfo/12 14
/proc/4839/fdinfo/11 7
/proc/4871/fdinfo/12 98
/proc/50565/fdinfo/10 3
/proc/50565/fdinfo/14 266
/proc/50565/fdinfo/25 186
/proc/50620/fdinfo/19 164
/proc/5192/fdinfo/3 47697
/proc/5225/fdinfo/63 4
/proc/5274/fdinfo/23 3
/proc/6121/fdinfo/7 38
(...)
The number between /proc/
and /fdinfo/
is the PID of the process and the last number is the number of inotify instances used by that process.
In the example the PID 5192
uses the most instances. To get the name of that process you can run:
ps -ax | grep 5192
And the culprit here is RubyMine:
5192 ? S 0:08 /snap/rubymine/325/bin/fsnotifier
303285 pts/1 S+ 0:00 grep --color=auto 5192
To fix this either tell the process to use less (no idea how to do that for RubyMine) or just crank up the limit.