zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.14k stars 3.08k forks source link

Support for manually refreshing projects when inotify/fsevents unavailable (e.g. on nfs file shares) #20044

Open kscott-1 opened 2 weeks ago

kscott-1 commented 2 weeks ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Within a pre-existing git repository locally cloned on remote machine, running git pull will not populate the dock with any new folders created from the pull.

Environment

Local- Zed: v0.159.6 (Zed) OS: macOS 15.1.0 Memory: 36 GiB Architecture: aarch64

Remote- OS: Rocky 8.8 / Linux 4.18.0-477.10.1 Architecture: x86-64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

No response

notpeter commented 2 weeks ago

Could you provide some info on the remote system? E.g. uname -a && grep -P '^(NAME|VERSION)=' /etc/os-release

kscott-1 commented 2 weeks ago

Could you provide some info on the remote system? E.g. uname -a && grep -P '^(NAME|VERSION)=' /etc/os-release

Sure, sorry -

4.18.0-477.10.1.el8_8.x86_64 (Rocky 8.8 Green Obsidian)

notpeter commented 2 weeks ago

When this happens is there anything notable in your local logs (cmd-shift-p, 'zed: logs') or in your remote logs (server-workspace-*.log under ~/.local/share/zed/logs)?

Also:

grep -H ''  /proc/sys/fs/inotify/max_user_watches
cat /proc/self/limits | grep 'Max open files'
kscott-1 commented 2 weeks ago

When this happens is there anything notable in your local logs (cmd-shift-p, 'zed: logs') or in your remote logs (server-workspace-*.log under ~/.local/share/zed/logs)?

Nothing appeared in the logs when I looked through. I can try to reproduce the bug when I have a chance.

grep -H ''  /proc/sys/fs/inotify/max_user_watches
cat /proc/self/limits | grep 'Max open files'

max_user_watches:975744 soft:1024 hard:262144

mati865 commented 2 weeks ago

Is your project on a remote machine stored on a local file system or a networked one, like NFS?

kscott-1 commented 2 weeks ago

Is your project on a remote machine stored on a local file system or a networked one, like NFS?

NFS file system

mati865 commented 2 weeks ago

This is the culprit, as I suppose you are mounting it and hosting it on a different machine. Inotify is a kernel mechanism, so it works correctly only on the host of the filesystem.

I mean if you open the project in any IDE (Zed, JetBrains, Atom, VS Code, etc.) that is located on NFS from within the host of the file system, it will work correctly. However, if you mount the same file system on another machine (let's call it a client), Inotify won't work. This is because the client kernel doesn't perform write operations, and instead the requests are sent via network to the host of the filesystem.

notpeter commented 1 week ago

Without support for inotify (Linux) or FSEvents (Mac) there is currently no way for Zed to be notified of changes. Thus Zed would need to periodically poll the entire project tree to identify if anything has changed (as well as maintain a cache of file inodes to make it possible to detect those changes).