You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Android: Sync conflict not detected: newest copy is propagated to other clients #4305
Let's say I have three devices (1 linux [A] + 2 android [B, C] if this is relevant). All devices are in sync. I switch off syncthing on all 3 devices.
I edit file X on device B, then C, then A. So file X has changed on all 3 devices.
I switch on syncthing on B, C, A.
I wait
After a while, the version of file X edited last on device A is propagated to B and C. There is not copy of the old version of X on B and C indicating a synchronization conflict.
I personally would expect to end up with at least two files indicating a synchronization conflict.
Is the situation describe in step 4 the expected outcome? Are my expectations about how synchting works wrong?
It is expected that you should get sync conflicts. I'm 99% sure that
2 android [B, C] if this is relevant
is the problem as Android doesn't keep proper mtime and we have a bunch of hacks around that. I thought those hacks worked, but there may be something else interacting here as well maybe, up to and including your changes not actually updating the mtime, making the change invisible to Syncthing. I'd lower my expectations on data integrity on the Android side.
I tested your scenario manually with three instances, one file changed on all three sides while Syncthing is off, then starting all three and got the expected result:
-rw-r--r-- 1 jb staff 36 Aug 17 12:00 test-appendfile
-rw-r--r-- 1 jb staff 36 Aug 17 12:00 test-appendfile.sync-conflict-20170817-120105-373HSRP
-rw-r--r-- 1 jb staff 36 Aug 17 12:00 test-appendfile.sync-conflict-20170817-120105-MRIW7OK
So I'm fairly sure this is specific to either Android in general or your test on Android in particular. Which doesn't help you much, but perhaps narrows this down for someone who wants to troubleshoot it.
changed the title [-]Sync conflict not detected: newest copy is propagated to other clients[/-][+]Android: Sync conflict not detected: newest copy is propagated to other clients[/+]on Aug 17, 2017
Does the DB also contain info on file sizes? If so, a file could be considered unchanged only if the mtime is the same (or unknown on Android?) and if the file size hasn't changed. This wouldn't get mere replacements but that's better than the current situation.
I doubt it as the description includes stopping syncthing, doing the modification everywhere, then starting syncthing. The scan should unconditionally happen when it starts. I don't know if there's a sane way to test the RC on Android.
It tried the following (similar) scenario: 3 devices (1 linux [A] + 2 android [B, C]).
All devices are in sync. I switch off syncthing on all 3 devices.
I edit file X on device B, then C. So file X has changed on all 2 android devices.
I switch on syncthing on B, C, A.
I wait
After a while, the version of file X edited last on device C is propagated to A and B. There is no copy of the old version of X on B and C indicating a synchronization conflict.
I would expect to see at least one file indicating a synchronization conflict.
The check is done on mtime, size and permissions (already).
Can we not add a hash/digest comparison? If that's too much additional computation, we could do it only if there are multiple android devices when changes are detected and checking for conflicts.
There is no indication that a device is an android device.
Hash check means reading each file in full which is incredibly expensive, plus you'd have to store the digest somewhere.
Activity
calmh commentedon Aug 17, 2017
It is expected that you should get sync conflicts. I'm 99% sure that
is the problem as Android doesn't keep proper mtime and we have a bunch of hacks around that. I thought those hacks worked, but there may be something else interacting here as well maybe, up to and including your changes not actually updating the mtime, making the change invisible to Syncthing. I'd lower my expectations on data integrity on the Android side.
calmh commentedon Aug 17, 2017
I tested your scenario manually with three instances, one file changed on all three sides while Syncthing is off, then starting all three and got the expected result:
So I'm fairly sure this is specific to either Android in general or your test on Android in particular. Which doesn't help you much, but perhaps narrows this down for someone who wants to troubleshoot it.
[-]Sync conflict not detected: newest copy is propagated to other clients[/-][+]Android: Sync conflict not detected: newest copy is propagated to other clients[/+]tomtom commentedon Aug 18, 2017
Does the DB also contain info on file sizes? If so, a file could be considered unchanged only if the mtime is the same (or unknown on Android?) and if the file size hasn't changed. This wouldn't get mere replacements but that's better than the current situation.
calmh commentedon Aug 18, 2017
The check is done on mtime, size and permissions (already).
lib/model: Move stale scan check info finisher (ref syncthing#4305, fix
lib/model: Move stale scan check info finisher (ref #4305, fix #3742)
AudriusButkevicius commentedon Aug 22, 2017
So I think this is fixed in the RC.
calmh commentedon Aug 22, 2017
I doubt it as the description includes stopping syncthing, doing the modification everywhere, then starting syncthing. The scan should unconditionally happen when it starts. I don't know if there's a sane way to test the RC on Android.
lib/model: Move stale scan check info finisher (ref syncthing#4305, fix
AudriusButkevicius commentedon Sep 5, 2017
@tomtom can you please test the scenario again once android version is released?
tomtom commentedon Sep 7, 2017
It tried the following (similar) scenario: 3 devices (1 linux [A] + 2 android [B, C]).
All devices are in sync. I switch off syncthing on all 3 devices.
I would expect to see at least one file indicating a synchronization conflict.
AudriusButkevicius commentedon Sep 7, 2017
To be honest, sounds like Android. I suspect if you doit only on linux and android it should work.
snugghash commentedon Oct 29, 2017
Can we not add a hash/digest comparison? If that's too much additional computation, we could do it only if there are multiple android devices when changes are detected and checking for conflicts.
AudriusButkevicius commentedon Oct 29, 2017
There is no indication that a device is an android device.
Hash check means reading each file in full which is incredibly expensive, plus you'd have to store the digest somewhere.