Skip to content

Frequent rescans due to group ownership issue #9879

Closed

Description

@w-oertl

What happened?

I have two Linux machines, each running syncthing as root, keeping multiple directory trees in sync. I know that this is not recommended, but I have multiple users on both machines and I wand to run just one instance of ST. It works as expected.

However, I noticed full rescans every 10-15 seconds. A large number of files is briefly shown as out-of-sync in the web interface, the same ones again and again.

Finally I found that all those files had group id 1000, which had different names on the two machines, and one group name didn't even exist on the other machine at all. After changing the groups to match, these rescans stopped.

It seems that this situation isn't being handled well right now. There were no helpful log messages.

Syncthing version

v1.28.0

Platform & operating system

Linux arm64

Browser version

No response

Relevant log output

No response

Activity

  1. added
    bug
    needs-triage
    on Dec 19, 2024
  2. astralbat commented on Jan 30, 2025

    @astralbat

    I'm also getting files constantly resynced between two machines: one Linux/ZFS, the other an iMac with modifications being claimed on both sides. I can cause all these files in a small folder to be 'modified' on-demand by simply pressing "Rescan".

    I can get this to stop if I stop syncing ownership. I.e. hitting "Rescan" doesn't sync anything. Unlike the author, I haven't tried changing my uids/gids to match.

    I followed the Syncthing documentation regarding owner sync. I have setup for each file in this small folder:

    • iMac: Uid=501/mark, Gid=20/staff
    • Linux: Uid=3000/mark, Gid=50/staff

    Syncthing is doing the right thing for me in finding an alternative Uid/Gid to match on the Linux side as I sync primarily from iMac -> Linux.

  3. astralbat commented on Jan 30, 2025

    @astralbat

    In

    // If we care about either ownership or xattrs, are recording inode change
    // times and it changed, they are not equal.
    if !(comp.IgnoreOwnership && comp.IgnoreXattrs) && f.InodeChangeNs != 0 && other.InodeChangeNs != 0 && f.InodeChangeNs != other.InodeChangeNs {
    return false
    }

    I have a feeling that this is involved as my change times are never the same on both sides (about 10s apart, I suspect due to the fs watcher time). So I ran some experiments clicking rescan from the Linux/ZFS side:

    • Sync Ownership on = all files detected as changed.
    • Send Ownership on only = all files detected as changed.
    • Sync Extended attributes on (Sync/Send ownership off) = no files detected as changed.

    So mabye it is having a ctime difference and having a uid/gid difference that's causing the files to contantly sync.

  4. astralbat commented on Feb 3, 2025

    @astralbat

    On further examination it seems change times are never set; only read. This behaviour seems a bit contradictory to me. Could someone confirm, and also whether this seems relevant to this issue? I can raise another if required.

  5. astralbat commented on Feb 3, 2025

    @astralbat

    I wonder now whether change times might not be the issue here. They don't appear to be stored in the database, thus the global version seems to have a change time of 0 and won't trigger a rescan. This would make sense with my testing showing that the syncing of extended attributes not being a problem.

    Further down however:

    if !comp.IgnoreOwnership && f.Platform != other.Platform {
    if !unixOwnershipEqual(f.Platform.Unix, other.Platform.Unix) {
    return false
    }
    if !windowsOwnershipEqual(f.Platform.Windows, other.Platform.Windows) {
    return false
    }
    }

    And:

    func unixOwnershipEqual(a, b *UnixData) bool {
    if a == nil && b == nil {
    return true
    }
    if a == nil || b == nil {
    return false
    }
    ownerEqual := a.OwnerName == "" || b.OwnerName == "" || a.OwnerName == b.OwnerName
    groupEqual := a.GroupName == "" || b.GroupName == "" || a.GroupName == b.GroupName
    return a.UID == b.UID && a.GID == b.GID && ownerEqual && groupEqual
    }

    Which I think is what the poster is referring to. For me also, I am syncing between Linux and Darwin platforms, so the platforms are different.

    Syncthing has a very good feature where it will look up the uid/gid on the destination side, but that intellegence is lost here. I am not going to submit a pull request, but it seems that syncthing should be storing the uids and gids on both sides to make a better comparison. Right now this seems like a lost feature and the workaround is to make sure they are the same, at least when the unix platforms are different.

  6. astralbat commented on Feb 3, 2025

    @astralbat

    As with the poster, after setting uids and gids to be the same on both sides, I am no longer picking any files when pressing the rescan button.

  7. huanqiugame commented on Feb 8, 2025

    @huanqiugame

    I have installed Syncthing (v1.29.2) on two Macs (absolutely running macOS). What I encountered is that files are continuously syncing, never stopping. I read this issue and turned "Sync Extended Attributes" off, and it soon showed me "Up to Date". I tested in a separate folder (both in internal and external disks, respectively, including only one file) and confirmed that the issue exists. Here, the only file synced almost every 10 seconds and the "File Created Time" was only showed on the device where it was created. In other words, it seemed like that attribute never really synced, causing a difference being noticed by the watcher and showing a 10 seconds interval between every sync.

    However, things seems to be a little different here. I tried turning on "Sync Ownership" and/or "Sync Extended Attributes", and found when the latter is turned on, regardless of the former, the issue shows up. It is the "Sync Extended Attributes" setting that goes wrong instead of "Sync Ownership".

    Also, I can provide additional information if required. Thank you all for working on this issue and the amazing software.

  8. added theissue type on May 30, 2025
  9. added a commit that references this issue on Jun 16, 2025
    0b0b214
  10. added a commit that references this issue on Jun 20, 2025
    259e9ef
  11. added a commit that references this issue on Jun 29, 2025
    1f8ce43
  12. added a commit that references this issue on Jul 5, 2025
    e968c74
  13. added this to the v2.0.0 milestone on Aug 12, 2025
  14. added
    frozen-due-to-age
    on Jul 1, 2026
  15. locked and limited conversation to collaborators on Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugfrozen-due-to-ageneeds-triage

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions