-
Notifications
You must be signed in to change notification settings - Fork 608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for inotify in mounted directories #1913
Conversation
One drawback I noticed: sometimes — say twice an hour — VM ( No such problem is observed on the stable branch. |
@aeifn Yes yes i am working on optimising it and address these crashes on high load |
@aeifn - Can you give a try now. |
a36e2fd
to
61eea4f
Compare
@AkihiroSuda I have tested this feature with reverse-sshfs, 9p, virtiofs on macOS. All these cases are working fine without issues. But might some help to test on linux and windows. |
9d20fbf
to
5359c05
Compare
Just a FYI, Am testing out GRPC for communication. I will create a follow-up PR to address this issue. I will keep performance out of scope for this PR. |
I tried to test it on macOS 12.7.3 (Monterey) on Intel, and it didn't work for me at all, both using Alpine and Ubuntu (default), with either reverse-sshfs or 9p: jan@lima-default:/Users/jan/suse/lima$ sudo -i
root@lima-default:~# inotifywait -m /tmp/lima
Setting up watches.
Watches established. I then run
$ l edit
Waiting for Emacs...
WARN[0021] `mountType: 9p` is experimental
WARN[0021] `mountInotify` is experimental
INFO[0021] Instance "default" configuration edited
? Do you want to start the instance now? Yes
… |
Same thing happens for me on macOS 14.3.1 (Sonoma) on M1: I don't get any inotify events (inside the VM) for files touched on the host, but I do get events for files touched inside the VM. Do I misunderstand how this is supposed to work? I expected that touch a file on the host would cause the guestagent to touch the file inside the VM, triggering an inotify event that could be captured by applications supporting hot-reload. I guess I can give it one more try using VZ, but I suspect I must be doing something else wrong. |
Same results with VZ. Only interesting observation was seeing these 2 lines during startup:
I don't think I've seen them before; could they be related? |
@jandubois Do you see any logs like |
@balajiv113 Yes, I do: $ ag inoti
lima.yaml
97:# Enable inotify support for mounted directories (EXPERIMENTAL)
99:mountInotify: true
ha.stderr.log
36:{"level":"info","msg":"enable inotify for writable mount: /tmp/lima","time":"2024-02-29T17:30:42-08:00"}
43:{"level":"info","msg":"enable inotify for writable mount: /Volumes/ThunderBlade","time":"2024-02-29T17:30:42-08:00"} |
Found the issue, /tmp/lima is a symlink to /private/tmp/lima. Thanks for the find, Will fix it. I was trying with home folder didn't encounter this :( |
Fixed the symlink issue. @jandubois - Can you try actually editing the file and see if that triggers a event. Instead of just touch. The problem is we are relying on When we do a touch, it triggers For now, I believe Note: Am not adding it to document, Because at some usecase, even touch will work. For instance, |
@jandubois PTAL 🙏 |
@balajiv113 I can confirm that the symlink issue seems to be fixed. I do get different results for touch vs. edit though. E.g. when I But when I then write to the file with e.g. This only happens for empty files. If the file contains data, and it is overwritten, then I do get a notification. Also it looks like I'm sorry, I only got to try the PR, I haven't yet found a big enough chunk of time to review the code in one sitting... 😞 |
This is intended. The reason is when we need to replicate the same pattern we will have complexity of handling the duplicate event in host. All we do is just touch the file in guest agent
I checked with some of the frontend hot reload like nextjs and it worked fine with attrib
I will check this case |
266143d
to
d25f948
Compare
@jandubois Note: As said above, We will always receive ATTRIB notification only. |
a471954
to
6724132
Compare
@jandubois PTAL |
I can confirm that it works now. I wonder if removing a file should send a notification or not. Because for me it doesn't. And if I remove a file from a webapp, shouldn't it trigger a hot reload? If this is hard/complex, then maybe documenting this as a limitation would be fine too. |
Our current model is to touch the file so that the guest consider something changed.
Will document as a limitation |
Signed-off-by: Balaji Vijayakumar <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, let's merge this
Fixes #615
Tasks
Approaches tried for triggering inotify in guest
chtimes/touch (Currently used)
But have issues with IDE (intellij keeps telling load file from system).Fixed by passing through host timechmod
Do suggest if there are someother approach for this.