Too many watchers?

I am sharing multiple folders on two linux computers. Both are running the same version of linux, and both are running the latest version of Syncthing. On one computer everything appears to be running with no problems. On the other, I get warnings about running out of watchers sometimes for only one folder, sometimes for all.

I followed the instructions for increasing the limit in /etc/sysctl.conf, but that had no effect. I even tried increasing the watchers to the max allowed. That didn’t work either.

I found a method on line to query the OS for the number of watchers actually in use. The respnse was “8181”.

Any ideas why syncthing thinks I am out of watchers?

Why do you think you are not? :slight_smile:

You need at least a number equal to the number of directories in the folders you’re trying to watch.

Because I know that I don’t have 524288 directories which is the number currently set in /etc/sysctl.conf.

And the FAQ explains why that’s different from “/etc/sysctl.conf”:

This only takes effect after a reboot. To adjust the limit immediately, run:

sudo sh -c 'echo 204800 > /proc/sys/fs/inotify/max_user_watches'

1 Like

I did reboot. I still get that the following message:

For the following folders an error occurred while starting to watch for changes. It will be retried every minute, so the errors might go away soon. If they persist, try to fix the underlying issue and ask for help if you can’t.

Storage failed to setup inotify handler. Please increase inotify limits, see https://docs.syncthing.net/users/faq.html#inotify-limits
Downloads failed to setup inotify handler. Please increase inotify limits, see https://docs.syncthing.net/users/faq.html#inotify-limits

As long as cat /proc/sys/fs/inotify/max_user_watches reports 8181, that’s the effective limit. What is in “/etc/…” is configuration, that may be ignored, overridden, … on your system, even though on most systems “/etc/sysctl.conf” is the canonical place to have these settings (and should take precedence over anything in “/etc/sysctl.d/”). So your best chances to get an answer is writing to your systems support venue asking why your changes to /etc/sysctl.conf don’t come into effect.

1 Like

Thank you imsodin. You gave me the clue I needed. I added the following line to /etc/rc.d/rc.local:

sysctl -w fs.inotify.max_user_watches=204800

and rebooted. That appears to have solved the problem.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.