The solution in these seems to be for users to unexpectedly run into the error, then scramble to somehow adjust the limits.
However, it almost seems like this NetBSD is meant to be somewhat official and patched up as needed - which I hope it is & I encourage you to do and would love to help test out! But then I’m wondering:
Is it possible to instead configure syncthing to chill out and operate within the default limits of NetBSD in a reasonable manner?
Would it perhaps make sense to have this configuration by default, and/or warn the user as soon as the UI opens at least that limits may need to be adjusted first?
Letting the sync start and all these errors happen later unexpectedly is a bit scary, since e.g. it may make the user wonder if any files will be lost due to this or what exactly is going on. So that this seems to be the current default situation, which I would love to help improve.
If there are any config ideas for syncthing I should try, to see if they fit in with the default NetBSD limits (that I’m currently using), let me know and I’ll test!
I forgot to point out: I used the syncthing build for NetBSD available on syncthing.net, and not the one provided via pkgin. So I’m using your syncthing build as-is, to get an experience as unaltered as possible.
I think the easiest solution is for the UI to give a “helpful” error message when it runs out of file descriptors, something explaining that one file descriptor is needed for each file being monitored on BSD systems. I don’t know what error message the current software displays.
One possible “improvement” to the underlying monitoring library would be to enhance the bits that use kqueue so that kqueue can be configured with a file limit and only the files most likely to change are monitored with kqueue and the remaining files are periodically scanned for changes. I could see files being added to and removed from kqueue monitoring dynamically. I could also see the scan period being dynamic and configurable. i.e. the longer the scan takes, the longer the period between scans can be so that the computer isn’t spending 100% of it’s time scanning files for changes.
I tested this now, and I can confirm disabling “Watch for Changes” in the “Advanced” tab of every folder fixes this.
However, this isn’t the easiest to do for an inexperienced user, since once syncthing ran out of file handles, it can’t even save the config file anymore.
So I think it would be a good idea to have this option be off by default on NetBSD, until this is handled in some more graceful manner.