Lockup on FreeBSD

Hi all, my FreeBSD syncthing jail keeps acting up, with syncthing running at >100% CPU, and I can’t connect to its GUI (timeout). Below, the snippet of log file before the lockup, the dump I got by kill -QUIT, and the resume log. After kill -QUIT, syncthing seems to have resumed normal operation… but for how long?


The stacktrace shows it’s currently scanning, that will cause some cpu load. And it’s likely to be scanning due to rather odd filewatcher issues repeating every minute like this:

[HU3DX] 11:22:58 INFO: Error while trying to start filesystem watcher for folder Documents, trying again in 1min: error while traversing /var/db/syncthing/Documents/setup/password-store/.extensions: no such file or directory

And you are running v1.4.0 - that’s somewhat old by now. In the meantime the watcher doesn’t retry every minute on failure, but backs off to up to an hour. Though that’s obviously just treating the symptoms.

I don’t understand why a non-existing file should cause the notify library to fail (which is kqueue on freebsd I think). Anything special about that path? What’s the folder root?

The root path to syncthing’s library is /var/db/syncthing/. 1.4.0 is the latest available at the time of writing in the FreeBSD repo. I have asked swills on IRC for an update.

And even though it’s scanning for a “dangling” symlink, syncthing should probably never hit >100% sustained CPU usage (it was at it for hours, from at least 11h…15h)

So the root cause is https://github.com/syncthing/syncthing/issues/5360

That’s the thing that is improved now: When there’s a watcher failure, a full scan is scheduled (as watch events might have been missed). Previously that has been done once a minute, which if your scans more than/close to a minute that leads to the sustained cpu usage you see. Now it’s only going to retry and thus scan once an hour after a few faster, failing retries (1h is the default full scan interval).

A patch is in progress to bring the FreeBSD port up-to-date. https://reviews.freebsd.org/D25576

Any particular reason why you don’t want to run the last downloadable version without having to wait for the FreeBSD package?

Because package management is best left to package managers?

And also because it’s less overhead to have all my software on my FreeBSD machines be handled by the same tools.

Just for the record though: I have a FreeBSD instance of syncthing running on my ~dead account at college, which runs the latest syncthing (as of writing: 0.17.0-rc1) as user with no issue (for at least 4 years now), and which updates automatically. But that’s only because I don’t have root privileges on that machine.

BTW, my understanding of why the port’s update has been so slow is because syncthing needed patches for aarch64 (https://reviews.freebsd.org/rP531427). Why it wasn’t sent upstream, etc. I have no idea. I’m just a user here.

I wouldn’t call “package management” to untar a file followed by a ./syncthing, but still, I’m not here to convince you! I guess that the question could be resumed like this: do you trust more the upstream developers or your OS package manager? It’s up to you, of course.

That’s not the question actually: Using either our or downstreams releases/packaging does not mean distrusting the other party. Good downstream packaging is an asset for us (upstream devs aka Syncthing maintainers). They will catch system specific bug reports (as in we get less support requests/issues we don’t know anything about) and sometimes even upstream system specific improvements/fixes. That’s especially true for somewhat niche systems which aren’t used by us Syncthing maintainers turns out I am not up to speed and calmh is using it :slight_smile: (no slight intended towards FreeBSD, but I think it’s not unfair to call it that).

In short: I personally recommend distro/arch specific downstream packaging, if it’s actively maintained (some release lag is to be expected, at some point it gets problematic though). Then also report your bugs to the packaging bug tracker (they will reach us (upstream) if relevant).

1 Like

It certainly isn’t unfair since looking at the statistics I see that the FreeBSD platform has a 1.8% share.

Thanks a lot for your explanation about how it is possible to help developers and maintainers!

I actually do use Syncthing on FreeBSD, but for me it just works. :slight_smile: