machine-drivers / docker-machine-driver-xhyve

docker-machine/minikube/minishift driver plugin for xhyve/hyperkit (native macOS hypervisor.framework)
https://godoc.org/github.com/machine-drivers/docker-machine-driver-xhyve
BSD 3-Clause "New" or "Revised" License
889 stars 73 forks source link

File modification monitoring doesn't work with 9p #112

Open blubber opened 8 years ago

blubber commented 8 years ago

The Django development server has an auto-reload feature, where it monitors the source code for changes and restarts the webserver if required. I tried to run the Django dev server in a docker container on top of xhyve, but the auto-reload feature kept continuously reloading the source code (i.e. it was detecting some kind of change continuously.) This was using a 9p shared drive.

When I run the exact same Django project in docker on top of xhyve using the NFS shared drive it works as expected.

I chacked if the system time inside the machine was OK, and it was. Sorry I don't have more info at this point.

Edit: the NFS shared drive seems to be extremely slow to notice modifications.

Strech commented 8 years ago

I have another one problem with virtio-9p. Some files become invisible for all commands. But they still available for ls, but if I do copy <folder> they will not copy.

And another one confusing thing

mounted folder

jceel commented 8 years ago

Hi, I just spotted that issue. There was indeed a bug with missing directory entries and it's fixed now.

zchee commented 8 years ago

@jceel Thanks reply. I'm surprised 😮 Now I have not been able to maintain this project, but will try latest version later.

thanks

georgecrawford commented 7 years ago

Hi.

I think I might be suffering from a similar issue as reported by @Strech. I'm using docker-machine-driver-xhyve with minikube:

docker-machine-driver-xhyve version 0.3.1
minikube version: v0.14.0
OS X 10.12.2

On creating a fresh VM (minikube start --vm-driver=xhyve), I can see my /Users directory mounted at the same location on the VM (minikube ssh). However, I've encountered a directory where the file count is wrong:

ls -l /Users/george/[MYDIR]/ | wc && minikube ssh -- ls -l /Users/george/[MYDIR]/ | wc
      90     803    8375
      88     785    8988

I can't see any logic as to the mismatch - if I shorten the file names, I get the same count. Below c.70 files, the counts tend to be the same, but above that, they get 2 out from each other. Two files (nothing special about them) are simply not listed on the VM.

Please let me know if you need any further information.

julienbachmann commented 7 years ago

The original issue title is File modification monitoring doesn't work with 9p. And i think there is an issue with that (so could you open other issues for other problem).

When you mount a folder in your container then modification time seen from python code are wrong. Here is an example:

folder /srv/server is a p9 mounted folder. If I launch a python console:

bash-4.3# python
Python 3.4.6 (default, Mar  3 2017, 23:29:12) 
[GCC 5.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.stat('/srv/server/org_management/user.py').st_mtime
1492764660.2692168
>>> os.stat('/srv/server/org_management/user.py').st_mtime
1492764660.4962165
>>> os.stat('/srv/server/org_management/user.py').st_mtime
1492764660.0202165

You can notice that the fraction part of the time is always different. If I do that on a file that is not from a mounted folder

bash-4.3# python
Python 3.4.6 (default, Mar  3 2017, 23:29:12) 
[GCC 5.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.stat('/srv/manage.py').st_mtime
1470231158.0
>>> os.stat('/srv/manage.py').st_mtime
1470231158.0
>>> os.stat('/srv/manage.py').st_mtime
1470231158.0

In this case you see that time is always .0

So I think there is an issue with the stat of mounted folder. Then if you try to use a mouted folder for development your code will always reload in loop :-(

My host is a Mac OS X 10.11.6 and I am runningminikube version: v0.17.1 and docker-machine-driver-xhive 0.3.2

justincormack commented 7 years ago

The 9p protocol does not support modification notifications, so this will never work.