The common development process for web-applications is that the server watches all of the source files and re-compiles (and re-serves, and re-loads) the application when any change. For example the react-scripts start script does this.

However, if the user limit on inotify watchers is exhausted it will silently fail to watch the sources! See for example https://create-react-app.dev/docs/troubleshooting#npm-start-doesnt-detect-changes and https://github.com/webpack/docs/wiki/troubleshooting#not-enough-watchers .

The solution is to increase the maximum number of watchers, e.g.,

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

But on Fedora for example the maximum number of watchers is already 8192. Where did they all go? You can find out with the following command:

ps x | awk ' /[n]ode/ {print $1, $6}  ' | while read -a cp; do echo ${cp[1]} `cat /proc/${cp[0]}/fdinfo/* | grep [i]notify | wc -l` ; done

Note the following features:

  1. We sub-select node processes only
  2. The PID and command line invocation is printed for each of these
  3. These are read into a bash array variable (read -a)
  4. Watches are identified by searching for inotify in the file descriptor information output

On my development system the output was:

./node_modules/.bin/serverless 7
/home/user/.emacs.d/elpa/tide-3.2.3/tsserver/tsserver.js 5627
/home/user/.emacs.d/elpa/tide-3.2.3/tsserver/typingsInstaller.js 0
/home/user/.emacs.d/elpa/tide-3.2.3/tsserver/tsserver.js 2348
/home/user/.emacs.d/elpa/tide-3.2.3/tsserver/typingsInstaller.js 0
/home/user/work/carabiner/fe/node_modules/.bin/react-scripts 0
/home/user/work/carabiner/fe/node_modules/react-scripts/scripts/start.js 141