hnsl / unox

Unison OS X unison-fsmonitor adapter.
101 stars 12 forks source link

Failing to monitor directory #9

Closed nhi-vanye closed 7 years ago

nhi-vanye commented 8 years ago

For reference, the top directory I'm trying to monitor has ~11000 sub-directories and ~76000 files. Directory structure is

DIR/git-repo-1 DIR/git-repo-2

(each repo is nominally the same)

The initial synchronization works, but watching fails which is my killer use-case (edit on mac and sync over to docker host (not container) for compiling in a container)

It seemed quite happy yesterday - I had the same directory structure handled by two unison's - each running one of the git repos. I hit the same error yesterday when I wanted to sync git-repo-1 to a second host.

unison in debug mode gives no additional information.

  Waiting for changes from server                                       
Fatal error: Server: Filesystem watcher error: cannot add a watcher: system limit reached
The watcher can be disabled by setting preference 'watch' to false
mickaelperrin commented 8 years ago

You need to increase the limit of inotify watchers on both ends:

on Mac:

 sudo sysctl -w kern.maxfilesperproc=100000
 sudo sysctl -w kern.maxfiles=100000
 ulimit -n 100000

On Linux:

 echo fs.inotify.max_user_watches=100000 | tee -a /etc/sysctl.conf && sysctl -p

Hope it helps