Lot of open files with 1.18.1

Hi,

I have a two peer setup, one side is Linux and the other is FreeBSD, running 1.18.1. The FreeBSD side is encrypted. The Linux side is the source, which I want to synchronise to the FreeBSD side. The former has the following state:

                           files     dirs       size
Local State (Total) 	 358,741   61,967   ~155 GiB

During watching the process I found out that the FreeBSD process has a lot of open file descriptors, which slowly build up during the sync:

procstat -f 21452
721411

From these 721375 are actual files from the synchronised folders.

The open files are all similar: /finestra/cvs/9.syncthing-enc/V8/F0T9J11975UJB388AC5CV3MFJG14R3PH00DD8STH17I47OJPGEROVP31PHLP6IGN5JGQBHQSFITOKGHF0S57LVB26PRNM6LL99OV7NM1V3MRJNQ32RAIGG411R02QO6LV0FJU5OGRGO8GCC

On the other side, the Linux version keeps very few files open

ls /proc/3344916/fd | wc -l
35

And here no actual synchronised files are open, just the usual stuff (pipes, network etc and the DB files).

Is this related to the FreeBSD port of the encrypted files?

This does seem like quite a lot, but I think watching might need a descriptor per file on BSD.

How does it look like if you disable watching?

2 Likes

Yes, this. Every thing that we watch gets a file descriptor on BSD.

3 Likes

Thanks a lot guys for the quick response! Confirmed, when I disable watching, the BSD host has the same (low) amount of open descriptors as its Linux counterpart.

2 Likes