Skip to content
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

rsync-auto not working on Mac OS X #3108

Closed
havvg opened this issue Mar 11, 2014 · 32 comments
Closed

rsync-auto not working on Mac OS X #3108

havvg opened this issue Mar 11, 2014 · 32 comments

Comments

@havvg
Copy link

havvg commented Mar 11, 2014

Hi there, I just updated to 1.5 and would like to switch from NFS share to rsync.

When running $ vagrant rsync everything is fine and gets updated, however running $ vagrant rsync-auto only outputs the following and does nothing upon file changes.

==> default: Watching: /Users/toni.uebernickel/Development/trnd/repository/trndSphere2
 INFO rsync-auto: Listening to paths: ["/Users/toni.uebernickel/Development/trnd/repository/trndSphere2"]
 INFO rsync-auto: Listening via: Listen::Adapter::Darwin

Running a manual $ vagrant rsync synchronises the changes correctly again.

Some debug information:

 INFO global: Vagrant version: 1.5.0
 INFO global: Ruby version: 2.0.0
 INFO global: RubyGems version: 2.0.14
 INFO global: VAGRANT_EXECUTABLE="/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.5.0/bin/vagrant"
 INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="/Applications/Vagrant/bin/../embedded"
 INFO global: VAGRANT_INSTALLER_VERSION="2"
 INFO global: VAGRANT_DETECTED_OS="Darwin"
 INFO global: VAGRANT_INSTALLER_ENV="1"
 INFO global: VAGRANT_INTERNAL_BUNDLERIZED="1"
 INFO global: VAGRANT_LOG="debug"
 INFO global: Plugins:
 INFO global:   - bundler = 1.5.3
 INFO global:   - i18n = 0.6.9
 INFO global:   - log4r = 1.1.10
 INFO global:   - micromachine = 1.1.0
 INFO global:   - mime-types = 2.1
 INFO global:   - rest-client = 1.6.7
 INFO global:   - vagrant-login = 1.0.0
 INFO global:   - vagrant-share = 1.0.0
 INFO global:   - vagrant-vbguest = 0.10.0
...
 INFO vagrant: `vagrant` invoked: ["rsync-auto", "--debug"
...
DEBUG host: Trying: bsd
 INFO host: Detected: bsd!
 INFO runner: Preparing hooks for middleware sequence...
 INFO runner: 2 hooks defined.
 INFO runner: Running action: #<Vagrant::Action::Builder:0x000001014a0180>
 INFO cli: CLI: [] "rsync-auto" ["--"]
DEBUG cli: Invoking command class: VagrantPlugins::SyncedFolderRSync::Command::RsyncAuto ["--"]
DEBUG rsync-auto: Getting target VMs for command. Arguments:
DEBUG rsync-auto:  -- names: []
DEBUG rsync-auto:  -- options: nil
DEBUG rsync-auto: Loading all machines...
 INFO rsync-auto: Active machine found with name default. Using provider: virtualbox
 INFO environment: Getting machine: default (virtualbox)
 INFO environment: Uncached load of machine.
...
==> default: Watching: /Users/toni.uebernickel/Development/trnd/repository/trndSphere2
 INFO rsync-auto: Listening to paths: ["/Users/toni.uebernickel/Development/trnd/repository/trndSphere2"]
 INFO rsync-auto: Listening via: Listen::Adapter::Darwin
$ vagrant plugin update
Updating installed plugins...
All plugins are up to date.
$ vagrant plugin list
vagrant-login (1.0.0, system)
vagrant-share (1.0.0, system)
vagrant-vbguest (0.10.0)
@jschneider81
Copy link

Hi there, I'm experiencing the same effect with a Windows 8.1 Host and with c:\cygwin\bin in PATH.
vagrant rsync works, but vagrant rsync-auto doesn't seem to do anything on file changes.

@mitchellh
Copy link
Contributor

It looks like it may not be getting your changes. We use the listen gem for this. At the point where you're seeing no output, all the work is done by that gem.

I would need to be able to reproduce this to help at all. Unfortunately, it works for me and the few people I pinged to test it... if you can come up with a clean repro case or if you can dig deeper, I'd apprecaite it! Thanks!

@arnaudbreton
Copy link

I experience the same issue with the rsync auto command.

After testing with different cases, it seems that the issue occurs when the watched folder has a big depth and a lot of (small) files. If you narrow the watched path, the watcher reacts faster.

Since the command watches excluded folders (see #3159), in our case it also watches folders like .git, symfony2 cache folder, etc.

Hope it helps.

@mitchellh
Copy link
Contributor

That's interesting. A bit under the covers: Vagrant will use something like inotify (I think on Darwin its called "fsevents") to listen for changes. So really it is up to the operating system to report those changes. Vagrant isn't polling or anything like that. This was supposed to avoid any deep slowness.

@arnaudbreton
Copy link

Yep I've seen that.

Could you please provide us a build of the rsync plugin excluding folders from watch ?

@mitchellh
Copy link
Contributor

@arnaudbreton Yes, there is another issue tracking that, and I shall.

@arnaudbreton
Copy link

You talk about #3159 ?

For information, I'm currently experimenting to launch vagrant rsync (not auto) via grunt-watch (https://github.com/gruntjs/grunt-contrib-watch), it is definitely faster to catch the changes.
I guess that a valid reason is that grunt watch is watching only some defined paths, not all the subpaths.

I would be happy to test a custom build myself if there is instruction about building plugins and how-to replace bundled one.

@drpebcak
Copy link

@arnaudbreton can I ask what code you added to your gruntfile to trigger vagrant rsync?

@arnaudbreton
Copy link

Sure. Here's the tasks' code: https://gist.github.com/arnaudbreton/9517344

@drpebcak
Copy link

Thanks!

@Morriz
Copy link

Morriz commented Mar 17, 2014

Hi, I think rsync is not properly instructed to sync just the files that fsevents hands off....when I do a watch in vagrant, and just change one file on the host, my watch detects all files being modified. That leads me to infer the following:

  • rsync is doing root folder sync, so not just the files and folders found by fsevents
  • rsync is modifying all files on the guest, probably because times are different somehow (if that would be true it would be another important issue)

I hope rsync is not configured to sync entire folders after fsevents has done most of the work already: detect and report changed files. It would be mad to then let rsync redo that work by going over each file one by one.

It would be awesome if somebody could check this. It could be a gain to have rsync work with specific paths. It might be the solution to the problem reported.

@Morriz
Copy link

Morriz commented Mar 17, 2014

@arnaudbreton: in that case I would bypass vagrant's rsync altogether, and modify your script to selectively sync the reported files and folders. It's just another one-line shell operation I guess.

I will test this when I have the time, but maybe somebody beats me to it ;)

@arnaudbreton
Copy link

I think this fix could solve your issue: #3186

Let me know

@Morriz
Copy link

Morriz commented Mar 21, 2014

Finally had a chance to test, and it runs smooth ;)

Tnx guys!

@fabioneves
Copy link

rsync-auto not working for me either, need to manually run vagrant rsync so I can see my changes. NFS is not an option since it's slow for me.. it takes some seconds to see my changes. Any news on this?

@Morriz
Copy link

Morriz commented Mar 21, 2014

Are you on 1.5.1? If not, update :)

@fabioneves
Copy link

Yes, I am.

@Morriz
Copy link

Morriz commented Mar 21, 2014

What is not working for you?

@fabioneves
Copy link

Simple test, renaming one vhost to a wrong dir, so I can get a 404 not found.

  • if I type vagrant rsync, I can get that 404 right away, meaning it syncs with the vm
  • If I have vagrant rsync-auto, nothing happens, looks like it doesn't do anything at all

@Morriz
Copy link

Morriz commented Mar 21, 2014

I would not deduce that from this info, but you are probably withholding other findings?

vhosts that automatically reload? what technology are you using?

@fabioneves
Copy link

Hehe, no they don't reload. For example you have a vhost example.com mapped to /var/www/vhosts/example.com.

  • If you rename the folder example.com and go to http://example.com you'll get a 404 because that folder doesn't exist anymore.

Anyway this is not the relevant point here, it was just to check how instant was the changes to the VM, in this case it never happens with rsync-auto. Can't really use vagrant now, as none of the other sharing options works for me without some delay anyway. I'm using a macbook air with a pci-e ssd, so the disk speed is not an issue here.

@arnaudbreton
Copy link

The discussion about rsync slowness are here: #3249

@jehoshua02
Copy link

I actually found that vagrant rsync-auto just takes a long time to detect changes in the file system and then eventually does do the rsync. Still, not acceptable. It's funny I moved to rsync to decrease page load, but then suffer greater time loss waiting for rsync-auto to hear a file change.

@jmreicha
Copy link

A little late to the party, but I am experiencing the same issue on Mac OS X 1.8. However, I am unable to reproduce the problem on 10.9. Also, I am on Vagrant 1.5.3.

@fabioneves Did you ever find a workaround or a solution?

@jehoshua02
Copy link

@jmreicha Workaround?

@erez-rabih
Copy link

Hi,
I am also suffering from this problem.
When I run rsync-auto and change some file under the synced folder no rsync operation is being fired.
When I run vagrant rsync I can see the changes on the VM.
The same happens when I am trying to use the vagrant-gatling-rsync plugin.
It seems that the problem is where the OS should notify the rsync listener on file changes.

I am on Mac OSX 1.9.5 and Vagrant 1.7.2

Any advice which can help me?

@tuguilucian
Copy link

same here

@erez-rabih
Copy link

I found a solution to my problem. Apparently, rsync-auto on mac doesn't work well when there are uppercase and lowercase letters in the directory name.
My directory was myAPP and rsync-auto didn't catch file changes. I then changed the directory to be myapp (all lowercase letters), fired rsync-auto again and it worked well.

Hope this will help other people who go frustrated as me :)

@danshumaker
Copy link

To help other googlers, I just found the solution to my rsync-auto problem by adding the --poll arguement to the command. mentioned here

@SeanRoberts
Copy link

I am experiencing this issue on MacOS 10.12 and Vagrant 1.8.6. Initial rsync works as expected but rsync-auto takes upwards of 30 seconds to catch and write a change.

@SeanRoberts
Copy link

Reinstalling rsync via homebrew seems to have solved this for me. Adding the --poll option as @danshumaker said worked as well but it also seemed to stress my CPU and battery a fair amount.

@ghost
Copy link

ghost commented Apr 3, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests