I observe a strange effect: Syncthing CPU usage seems to slowly increase over time on my embedded x86_64 Debian 12 system.
After a fresh start of the service, it stays very well below 1 %, after 2 days, it uses over 2 %. That’s not heavy, but it keeps growing slowly and increases power draw of the otherwise mostly idle system noticeably.
Running strace
on the Syncthing process (following forks) reveals a high rate of:
[pid 1605] epoll_pwait(4, [], 128, 0, NULL, 0) = 0
[pid 1605] epoll_pwait(4, [], 128, 0, NULL, 0) = 0
[pid 1605] epoll_pwait(4, <unfinished ...>
[pid 962] <... nanosleep resumed>NULL) = 0
[pid 962] futex(0x1a2afa0, FUTEX_WAIT_PRIVATE, 0, {tv_sec=0, tv_nsec=2996919}) = -1 ETIMEDOUT (Connection timed out)
[pid 1605] <... epoll_pwait resumed>[], 128, 13, NULL, 0) = 0
[pid 962] nanosleep({tv_sec=0, tv_nsec=10000000}, <unfinished ...>
[pid 1605] epoll_pwait(4, [], 128, 0, NULL, 0) = 0
[pid 1605] epoll_pwait(4, <unfinished ...>
[pid 962] <... nanosleep resumed>NULL) = 0
[pid 962] futex(0x1a2afa0, FUTEX_WAIT_PRIVATE, 0, {tv_sec=0, tv_nsec=1697811} <unfinished ...>
[pid 1605] <... epoll_pwait resumed>[], 128, 12, NULL, 0) = 0
[pid 962] <... futex resumed>) = -1 ETIMEDOUT (Connection timed out)
[pid 1605] epoll_pwait(4, <unfinished ...>
[pid 962] nanosleep({tv_sec=0, tv_nsec=10000000}, <unfinished ...>
[pid 1605] <... epoll_pwait resumed>[], 128, 0, NULL, 0) = 0
[pid 1605] epoll_pwait(4, [], 128, 0, NULL, 0) = 0
[pid 1605] epoll_pwait(4, <unfinished ...>
[pid 962] <... nanosleep resumed>NULL) = 0
[pid 962] futex(0x1a2afa0, FUTEX_WAIT_PRIVATE, 0, {tv_sec=0, tv_nsec=3958898} <unfinished ...>
[pid 1605] <... epoll_pwait resumed>[], 128, 14, NULL, 0) = 0
[pid 962] <... futex resumed>) = -1 ETIMEDOUT (Connection timed out)
These are much less after a restart of the service.
Enabling debugging at runtime does not yield anything relevant at first glance.
Checking the FDs, file descriptor 4 of PID 1605 is:
anon_inode:[eventpoll]
I have also tried to disable inotify
watching for all folders (but without restarting Syncthing), in case this would be related, but no change in CPU usage was observed.
The only “special” configuration of the system is staggered versioning, but no multiple connections etc. are used.
Since restarting the service makes CPU usage drop: Does anybody have a good idea on how to debug this?