An Interest In:
Web News this Week
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
- March 26, 2024
- March 25, 2024
Running VSCode On Linux: Hitting My Watcher Limit And What To Do About It
I have been working on a Linux VM more recently, and one particularly annoying thing about it (there are a lot of little quirks that are frustrating) was that VSCode couldnt monitor for changes because it was out of watchers.
Watchers are part of the inotify
Linux kernel subsystem1 that extend the filesystem to notice changes and report on those changes to applications listening for them.2
There are, however, a fixed number of watchers, and evidently, my machines default (8192) was insufficient to the task.
The fix was relatively straightforward: increase the number of watchers. The guard/listen
repo has an informative post on the process. Quoting below3:
The technical details
Listen uses inotify by default on Linux to monitor directories for changes. Its not uncommon to encounter a system limit on the number of files you can monitor. For example, Ubuntu Lucids (64bit) inotify limit is set to 8192.You can get your current inotify file watch limit by executing:
$ cat /proc/sys/fs/inotify/max_user_watches
When this limit is not enough to monitor all files inside a directory, the limit must be increased for Listen to work properly.
You can set a new limit temporary with:
$ sudo sysctl fs.inotify.max_user_watches=524288
$ sudo sysctl -p
If you like to make your limit permanent, use:
$ echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
$ sudo sysctl -p
You may also need to pay attention to the values of max_queued_events and max_user_instances if Listen keeps on complaining
After making those changes, my VSCode was once again able to track my changes, which in turn, meant that the source control features were actually helpful and I didnt have to use the terminal to see my diffs.
Footnotes
- 1 Words, theyre hard and Im not sure I know exactly what they all mean.
- 2 inotify - Wikipedia
- 3 Increasing the amount of inotify watchers guard/listen Wiki GitHub
Original Link: https://dev.to/stephencweiss/running-vscode-on-linux-hitting-my-watcher-limit-and-what-to-do-about-it-52i0
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To