4

I'm running Ubuntu 14.04, when trying to sync a directory with Unison using the option repeat=watch. The directory contains ~125K files but I'm abutting a limit on the number of files Unison can handle. This is the error I receive:

Fatal error: Server: Filesystem watcher error: cannot add a watcher: system limit reached.
The watcher can be disabled by setting preference 'watch' to false.

I searched for more information by running Unison with debug=all but these are the only lines I can find related to the error.

Any idea as to what system settings need to be changed to get around this limit?

rzickler
  • 187
  • 1
  • 2
  • 8

3 Answers3

5

I'm fairly certain that the problem isn't with Unison, but with inotify. When you use the option repeat=watch, Unison calls a helper program unison-fsmonitor which uses inotify to watch the filesystem for changes. It puts a "watch" on each file that you are syncing with Unison.

By default there is an upper limit on the number of watches a single user can evoke. On my machine that upper limit is only 8192. You can increase the number of watches by editing the file

/proc/sys/fs/inotify/max_user_watches

I would be a bit concerned that since you want to watch about 125k files and the default maximum is only about 8k, you might see a dramatic hit in performance if you increase the maximum by that much.

Mike Pierce
  • 292
  • 3
  • 18
0

Unison makes use of three kind of files. The most relevant files are the profile files, with extension prf, which are by default stored in .unison. Each profile file specifies the variables and the preferences relative to one particual use of unison, like the directories which should be syncronized and the mechanism used to perform this synchronization. Alternatively, these preferences can be specified on the command line. The second type of files used by unison is the log file. Indeed, unison does in general produce a detailed account of its activity. This account is saved in the log file, which is by default named unison.log and placed in the user's home directory. Finally, in order to determine the files which have been modified and need an update, unison use an automatically named archive file, which is stored by default in .unison.

File: ~/.unison/home.prf

-1

You can add the line watch = false to your unison profile, and it should work, although without the "benefits" of the watcher.

Leopd
  • 643