Skip to content

Possible data loss in finisher with no versioning set up #10950

Open

Description

@dgudim

What happened?

This is a separate issue, originally started in #3897

Copying here:
I recently hit a bug where I was syncing a large folder to my phone which led to syncthing being killed by android. That's fine on its own, but it died in the middle of the temp - delete - rename chain and I lost some of the files. After restart syncthing saw missing files and propagated them as deletions to other machines.

I think that while this is rare, it's still a data loss possibility, especially in folders with no versioning.

Why not do an in-place rename over the file where it's possible to do atomically?

Relevant context:
#3897 (comment)

Why not do an in-place rename over the file where it's possible to do atomically?

Syncthing does exactly that, always. You've probably run into some other funky corner case of user space filesystem shims in Android or something.

@calmh If lib/model/folder_sendrecv.go:1736 doesn't delete the file from disk before the temp rename, what does it do?

if !curFile.IsDirectory() && !curFile.IsSymlink() && file.InConflictWith(curFile) {
// The new file has been changed in conflict with the existing one. We
// should file it away as a conflict instead of just removing or
// archiving.
// Directories and symlinks aren't checked for conflicts.
err = f.inWritableDir(func(name string) error {
return f.moveForConflict(name, file.ModifiedBy.String(), scanChan)
}, curFile.Name)
} else {
err = f.deleteItemOnDisk(curFile, scanChan)
}

Syncthing version

v2.1.7

Platform & operating system

Linux arm64 / Linux x86_64

Browser version

No response

Relevant log output

Activity

  1. added
    bug
    needs-triage
    on Nov 8, 2026
  2. added theissue type on Nov 8, 2026
  3. changed the title [-]Possible data loss in conflict handler with no versioning set up[/-] [+]Possible data loss in finisher with no versioning set up[/+] on Nov 8, 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

    bugneeds-triage

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions