EugenMayer / docker-sync

Run your application at full speed while syncing your code for development, finally empowering you to utilize docker for development under OSX/Windows/*Linux
GNU General Public License v3.0
3.53k stars 289 forks source link

Fatal error: system limit reached #125

Closed ZZromanZZ closed 8 years ago

ZZromanZZ commented 8 years ago

Hi, currently I'm dealing with problem with fswatch:

Fatal error: Server: Filesystem watcher error: cannot add a watcher: system limit reached

Increasing ulimit (-n and -u) in host system does not work.

Environment: Docker Toolbox (Virtualbox) OS X Yosemite 10.10.5 Docker-sync: current master branch (cd70ac6)

Docker-sync.yml:

syncs:
    workdir_sync:
        src:"/my-src"
        dest:"/my-dest" 
        sync_host_ip: "192.168.99.100"
        sync_strategy: "unison"
EugenMayer commented 8 years ago

@ZZromanZZ how many files do you sync? What about the size? @mickaelperrin do you have an idea here, ho to extend that?

mickaelperrin commented 8 years ago

We have to implement the way to increase the inotify limit for fswatch as I did with unison.

If you want to resolve it manually:

 sudo sysctl -w kern.maxfilesperproc=NBFILES
 sudo sysctl -w kern.maxfiles=NBFILES

However I ran ulimit -n in the same process of starting the unison watcher. Maybe the above commands will be sufficient. If not, we will need to patch to add the ulimit -n NBFILE && fswatch ... in docker-sync.

mickaelperrin commented 8 years ago

Mmmm, but wait... which version of docker-sync are you using ? In your config you have unison but you are talking about fswatch.

If you are using the latest docker-sync, there is a simple max_inotify_watches to add in the docker-config.yml file. See https://github.com/EugenMayer/docker-sync/blob/c4e9f21bc4c6510e8186e25765a1f786e31ad470/example/docker-sync.yml#L75

ZZromanZZ commented 8 years ago

I set max_inotify_watches and it works as expected.

I am sorry for unnecessary issue.

EugenMayer commented 8 years ago

@ZZromanZZ great it worked, thanks @mickaelperrin for the hint!

vovcacik commented 7 years ago

I haven't noticed performance degradation. sudo su -c 'echo 262144 > /proc/sys/fs/inotify/max_user_watches'