Events not firing over vagrant shared folder #53

Closed
drnic opened this Issue Jul 16, 2012 · 8 comments

Projects

None yet

5 participants

@drnic
drnic commented Jul 16, 2012

Scenario:

  • Running listen (via kicker) inside vagrant
  • It is watching a file within a vagrant shared folder (e.g. /vagrant/README.md)
  • When I touch the file within vagrant, listen triggers (and kicker does its thing)
  • When I touch the file outside of vagrant, listen does not trigger
  • Yet, the filestamp of the watched file has changed as expected
@drnic
drnic commented Jul 16, 2012

/cc @johnbender @mitchellh (suggests from vagrant perspective?)

@mitchellh

This is due to the way that the VirtualBox shared folder system is implemented. It doesn't properly trigger filesystem notification events on the guest if it is touched from the host (and vice versa as well).

I don't think this is a bug with this project or Vagrant. However, listen may be able to watch file system properties (file mtime and such) and see the differences.

@Maher4Ever
Member

Listen has a polling adapter which does not depend on filesystem notifications. Could you try it and see if it helps? (To use it you have to enable the :force_polling option. See the readme for more info)

@thibaudgg
Member

I just come back from vacation, this is still an issue?

@ideasasylum
Contributor

I'm also having this same issue. Polling works fine for me (Lion as the host, Ubuntu 12.04 as vagrant) but I'd rather not eat up my processor time unnecessarily.

To understand this better: is this a problem outside of listen, or is it something which can be fixed in listen? I note elsewhere that Watchr appears to work in this scenario (I've yet to try it myself) and judging by their implementation they keep track of the a/m/ctime: https://github.com/mynyml/watchr/blob/master/lib/watchr/event_handlers/unix.rb

@thibaudgg
Member

@ideasasylum Watchr use a different (evented) approach than Listen (that have some caveat, like not detecting new files). So if VirtualBox shared folder doesn't trigger filesystem notification events I think polling is the only option here. Sorry.

@ideasasylum
Contributor

@thibaudgg ah, thanks for the explanation. If it was something that could be fixed I'd have had a go myself but polling seems like the best approach for the moment

@thibaudgg
Member

Yep, sadly.

@thibaudgg thibaudgg closed this Jul 30, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment