microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
160.52k stars 28.1k forks source link

Reduce file watcher use in Linux system by using inotify folder watch #219712

Open MathieuGirard opened 5 days ago

MathieuGirard commented 5 days ago

vscode is using a lot of file watchers. And on linux keep reaching the limits.

VScode appears to watch files instead of reusing watcher per folder (a folder watch includes change of files within that folder).

ex: Error: ENOSPC: System limit for number of file watchers reached,[...]

MathieuGirard commented 5 days ago

From man pages:

NAME         [top](https://www.man7.org/linux/man-pages/man7/inotify.7.html#top_of_page)
       inotify - monitoring filesystem events
DESCRIPTION         [top](https://www.man7.org/linux/man-pages/man7/inotify.7.html#top_of_page)
       The inotify API provides a mechanism for monitoring filesystem
       events.  Inotify can be used to monitor individual files, or to
       monitor directories.  When a directory is monitored, inotify will
       return events for the directory itself, and for files inside the
       directory.
bpasero commented 5 days ago

We are relying on a 3rd party file watcher and their implementation is here: https://github.com/parcel-bundler/watcher/blob/master/src/linux/InotifyBackend.cc

If you feel they could improve, please make sure to report it to their repo: https://github.com/parcel-bundler/watcher/issues

VSCodeTriageBot commented 5 days ago

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!