"failed to setup inotify handler"

I have a sync that is giving and error “failed to setup inotify handler. Please increase inotify limits, see FAQ — Syncthing documentation

Its only happening on one shared space between my DS1821+ at my office and a pc at my home. I’m not sure why its happening as I’ve been having shares between these 2 machines many times without issue. I wasn’t sure if it was something on the share directory, so I made a separate directory with a different name, copied the files in there (did not copy any hidden files or configs, just the media) and shared again, only to get the same error, so I’m assuming it has to do with the files/folders in the share? I referred to the linked support article on the error, but it only mentions Linux commands, and I dont know anything about Linux, Please help!

Heres a screenshot

Please post full UI screenshots from both sides.

Is this error happening on the DS1821+ or on the PC? What OS is the PC running?

I don’t know Synology at all, but my Google search “DS1821+ increase inotify limits” gave me some ideas that this isn’t particularly uncommon, and that it should be fixable.

@chaos thank you for your reply That would be important information to know and sorry i did not include! The error is only occurring on the DS1821+ side. I have many folders shared between that and this PC and have for over a year now, so its strange that its only coming up on the new folder I added. The PC is running Windows 10 and does not have any errors on that end.

1 Like

I would suggest you do the Google search I did – the first two hits are threads on this forum.

Keep in mind that your Synology device likely has limited RAM and changing these limits may impact performance, and while I suspect less likely could also impact stability.

Another option would be to stop using the Filesystem Watcher on your Synology device and rely upon periodic scans. This may be too slow to see changes for your purposes.

1 Like

It’s just coincidence, so it can be a bit misleading.

inotify is the Linux kernel’s subsystem for filesystem change notifications. One of the settings controls how many files can be watched simultaneously.

More than likely you happened to stay within the limit for more than a year, but the new folder added enough files to push you over, resulting in the error message. And it’s not specific to Syncthing. If you were to use a real-time backup app or another app that also watched for changes, a similar error would occur.

Even with the stock 4GB of RAM, the DS1821+ should have no problem with a higher setting that’s enough for a few hundred thousand files (each file watched requires 1,080 bytes of RAM, so best not to set it way higher than is needed unless you’ve got the RAM to spare).

Search the web and/or Synology’s knowledgebase/forum for how to adjust the inotify limits, specifically the max_user_watches kernel parameter.

2 Likes

Thanks for both of your replies! I’m still having a little bit of trouble wrapping my head around this. My current workflow is that I setup a folder share when we start a new project, and I will share it between the machines that need it, depending on what editor we determine will be working on it (each video editor has their own intel NUC10, and there is only really 3-4 of those currently being utilized) and then when the job is done I have an LTO7 tapedeck that I push the folder share onto for archive/backup before deleting it from the DS1821+/NAS and the editor-side PCs. The DS1821+ has just under 100TBs of storage, and I am rotating out old and new foldershares very regularly.

So, with all that being said, if the “inotify” is how you explained it, does that mean if I clear out a different project share that has a large amount of files, it will get rid of the error? Because I will be back under the limit threshold?

It might. Without digging into the internals of the device I can’t be sure, but it goes like this:

  • The filesystem watcher uses a resource known as “inotify handler”
  • The “inotify handler” uses a certain amount of RAM, so the operating system has a limit on how many can be invoked
  • You can increase the limit (with possible performance or even stability impacts) to remove the error
  • You can reduce the number of inotify handlers you’re using to remove the error

So yes, removing Syncthing Folders you don’t need any more may solve this issue.

Yes, reducing the number of files under a Syncthing folder that has file watching enabled will get rid of the error once the total is equal to or below inotify’s max_user_watches limit.

Adding to what @chaos has already described…

According to what I could find online, DSM on the DS1821+ might be using a Linux 4.4 kernel. If so, max_user_watches is a fixed size that’s manually set. It could be that Synology uses an artificially low preset.

As of Linux 5.11, max_user_watches is dynamically adjusted based on available RAM, up to a maximum of 1,048,576 files (requiring just over 1GB of RAM) unless overridden by the user.

1 Like

I’m pretty sure my DSM is in need of an update. But after removing 2TBs of media from one of my shares, as mentioned by you guys, the error did resolve itself. Thanks for your help!

1 Like