How to sync a file that is open by another process

I use syncthing to sync KeepassXC database files across hosts running various operating systems (windows, linux, android).

Conflicts syncing this file are seen from time to time. Subsequent comparison of the conflict-file with the up-to-date-file yields no difference. My guess is that these pseudo-conflicts happen, when the file that needs to be updated by syncthing is currently opened exclusively by an other process (KeepassXC in my case) - this would obviously prevent syncthing from changing the file in question.

Am I right? How to handle/circumvent this situation?

This really shouldn’t be the case because KeePass is coded in such a way that the database isn’t blocked from read/write, i.e. you can update the database file separately (e.g. on a remote device, then pull it back), and then KeePass will sync those changes upon save (using its own database sync mechanism). I think the only problem may arise if you attempt to modify the same data simultaneously, but even then it should just use the newest modifications.

Translating the above to Syncthing specifically, the KeePass database isn’t blocked from syncing at any time, even if the program is open and unlocked.

1 Like

I have the same issue when I am using a Keepassxc database synced on multiple hosts, one of which is Android. I think this is because Android’s update frequency can be a little slow/irregular allowing it to have a different version of the database from the other hosts.

So conflicts can be expected if a database is edited while out of sync.

I think Keepassxc’s internal ‘sync’ mechanism will only come into play for hosts that are using the same copy of the database.

KeepassXC Android-app uses caching of the database file. This setting is activated by default. Doing so increases the possibility for sync-conflicts.

I will deactivate this setting for now.