sync-conflicts

Also randomly doing -reset-database is likely to lead to conflicts as well.

1 Like

Sounds reasonable, yet if *.tmp is added at a later point to .stignore on both A and B, and all .tmp files have been deleted from both sides, then such files should be removed from the database and the devices should show each other as Up to Date. Instead one of them shows the other as syncing. Is this a logical error? How do I correct it without resetting the database?

Is it possible to sync .stignore between A and B and how?

.stignore has #include directive which can include a normal synced file. It’d all in the docs.

Syncthing usually does not delete anything from it’s database, even if the file is deleted, because it’s usually not sure that every device has observed the deletion. I think there was some work to improve that but I am not sure if it landed.

As for your example, please write it up as a reproducible step by step guide, that you’ve tested yourself in isolation and verified it works, and we’ll have a look. From what you described, it should not behave that way, but again, you haven’t provided steps to observe this ourselves.

Thank you Audrius! :slight_smile: I assume #include path/to/.gitignore should do the trick. Do I need to restart Sincthing to detect the changes? I will try to make a step by step when I find some time and write an update.

You mentioned many times that Syncthing is designed to be used in a very specific way so I would like to share a short story from when I started programming in school. I was highly motivated and created a project hoping to impress my good teacher. He crashed it instantly and told me not to come back until I make sure it cannot be used incorrectly. And so I did. Lesson learned: when we create a program we expect it to be used in a certain way. In reality users will use it however seems logical to them and we have to consider that won’t be harmful.

Someone is already in the process of doing that: https://github.com/syncthing/docs/pull/471

Nobody is saying there’s nothing to improve (I mean, otherwise what would be the point for me to work on Syncthing). The point is we need to know what exactly is going wrong. Until now you only write up huge production scenarios where something didn’t happen the way you’d want it to. Detailed information has been lost (-reset-db) and you haven’t come up with steps to reproduce the behaviour. So we are not saying you are wrong and Syncthing is perfect, we are saying we need a way to understand what goes on. Only then can we think about potential bugs or improvements.

1 Like

Here are a few steps to reproduce some of my issues:

Last couple of days I decided to follow author’s advice and #include path/.gitignore from .stignore, in order to sync the ignore list among devices. Then I moved some projects to different locations. A and B were in sync all the time, and everything was fine, but later I noticed that .gitignore ignores itself so I had to remove that. At that point A and B were in sync. C was behind, because B and C are the same computer. A, B, and C have an independent copies of my documents.

  • A is Windows 10 on desktop PC
  • B is macOS on MacBook Pro 2018
  • C is Windows 10 on MacBook Pro 2018.

Then A suddenly started recreating empty folders which used to include .gitignore. These folders were not present on B. No matter how many times I deleted them, they were instantly recreated. And it can’t copy them from C, because like I said B and C are the same device and B is online, so C is offline. Please correct this bug! Despite all warnings the only workaround is running -reset-database and -reset-deltas on all devices. After the reset, A and B eventually got in sync. Then I set A as Send only, shutdown B to start C, reset the database and set it Receive only to force it to catch-up. Things got quite messed up. No matter how many times I try telling C to revert all changes and accept what A is offering, it just did not listen to me. I had to resolve many conflicts manually, and restart A and C many times. Eventually I also had to -reset-database a few more times on both, until they got in sync. I also encountered errors where Syncthing said it had issues syncing a folder named §ужди where the actual folder name is чужди.

Two days later I noticed that some of my folders were renamed to random characters.

  • Original folder: Visual Studio 2019\Settings
  • Renamed to: Visual Studio 2019\321§

At this point, considering the many issues I have described, and especially related to changes in .stignore, I’d like to inform the Authors that Syncthing requires urgent attention to correct the many bugs and prevent data loss. I no longer consider using Syncthing safe.

Note to the authors: I know you’re stubborn and hate me for being so honestly negative about your software. But please try to swallow your pride and understand that I’ve spent all my energy on this forum in hope to help you improve Syncthing. Because I see it has a great potential, and I personally regret to see that the actual implementation is so unreliable and easy to get into a state where hosts can’t sync or old files are kept, while the new removed. You want me to reproduce the issues I encounter in a simple way. The thing is after I finish fighting all the issues, and get my computers in sync (which takes me days for what should take a couple of minutes), I have no energy or time to do anything. And my entire schedule is delayed by days which I need to catch up. Next time I should just screen capture the entire painful process and upload everything to YouTube for the world to see.

Sorry, but if we have no way of experiencing what you are experiencing, we have no way of observing the issue and finding the bug to fix it.

Describing seemingly random things you did and things you’ve observed does not make it into an empirical step by step scenario of how we could use to observe this and fix this.

This has nothing todo with pride, but with lack of sensible information which we could follow to fix this.

If you are out of energy trying yo reproduce it, then don’t reproduce it, but there is no point coming around complaining yet not providing the single thing that we need to fix this.

This adds no value and does not help actually solve the problem.

Also, you seem to be doing seemingly random things, .gitignore and .stignore are incompatible syntaxes, so I am not even sure what the result of that would be.

You are free not to use syncthing if you think it’s unsafe.

3 Likes

Thank you Audrius! Regarding .gitignore and .stignore, looking into Syncthing’s documentation I see that the small set of features I use in .gitignore are exactly the same for .stignore. This is very convenient, because the ignore list is long and having to maintain a single copy simplifies things a lot. :slight_smile: .stignore also allows to force sync a !file before including .gitignore, so I can exclude it from git, but sync it across devices. I’m not an expert, and there might be differences, but as long as I keep the filters simple, it will be fine.

I agree that the best way of solving a problem is by having a simple step-by-step list of actions to reproduce it. I was also hoping that someone experienced enough in the program design would be able to follow my description and come with a possible reason.

Sorry, but I don’t think we have anyone experienced enough in using a crytal ball.

What should I do if all folders show as Up to Date, but the devices show each other as Syncing 95% and this never completes?

Do you have a screenshot from the other side?

It’s also possible this is due to https://github.com/syncthing/syncthing/issues/6335, which is currently being fixed.

Also possible due to ignoreDeletes?

Is that a good strategy, to decide on order of observation? That strikes me as strange. What is the reason for this?

Now we need to make sure we are talking about the same thing here: Syncthing’s primary “version system” does not depend on system clocks. Reason is already given by Audrius:

More generally: Whatever one device uses as its time does not necessarily match anothers. Plus it wouldn’t matter anyway, if two devices edit after each other in time but both based on the same old version, it’s still a conflict.

However when a conflict is detected within Syncthing, then modification times come into play when determining which to rename to the conflict file and which to leave as is. Here the file with the earlier mod time is chosen. Again due to clock inaccuracies this might be wrong, but it’s still better than flipping a coin to choose a file.

1 Like

Hi Audrius, I did not upload a screenshot from the other host, because it looked exactly the same. Ignore Delete is unchecked on all devices and I have never used this option.

Perhaps it’s the bug in quoted above then.

Suggest you try the new release candidate and potentially run the checking utility to see for database consistency.

@imsodin I did had a crash two days ago, when one of the computers A got a blue-screen while resuming from hibernation. Syncthing was running. I ran chkdsk /x on all disks. The bug you pointed to might be related to what happened next or due to a bad initial sync from the previous day: The next time I started Syncthing, it renamed Visual Studio 2019\Settings to Visual Studio 2019\321§, and propagated this to B. But the day before that I had a similar problem where another device’s database C had to be reset and then it complained about a folder showing its name incorrectly as §ужди, instead of чужди.

@AudriusButkevicius To make sure everything is all clean and consistent, last night I decided to -reset-database and then -reset-deltas on all devices. Remember B and C can’t run at the same time. So I started with A and B, made sure they are in sync, then switched from B to C, reset the database and then it couldn’t get in sync with A. Similar to the last screenshot. I have everything on video. So I was forced to reset the database again on both A and C and eventually they got in sync. These initial syncs after reset seems to be hard to achieve. Later I found that I need to change some files. I made sure A and C are in sync. Then restarted from C to B, but forgot to set A as Send Only and all changed files got sync-conflicts with B. I found that the best way to keep three devices in sync when only two can be active at the same time is to restore the same files and ignore list on all devices, then reset all databases, then sync A and B, then A with C and then A and B again, without changing any files. What I learned in this process is that since B and C cannot communicate directly, they communicate over A. All devices are set as introducers to each other. I also learned that making changes to the ignore list needs to be reviewed, because it is the source of many problems.

Audrius, I recorded almost 2 hours of screen time on A and C simultaneously. Would you like me to share them and should I edit them or leave the raw material? For me the easiest thing to do is to upload them to my server. VLC can open the AVI files created by Camtasia Recorder. I can also encode them to .mp4 or upload to YouTube, but that would take many hours of my time, especially if I have to edit or cut boring scenes. I should at least cut a few parts where the API key and a few passwords were revealed by accident. The videos show more details to what I have described here, but include a long and boring rescans after a few database resets until A and C finally get in sync.

If you had any crashes, it’s very likely you were affected by a bug fixed in 1.4.0. So any out-of-sync issues in that context don’t need to be investigated until you get them again on 1.4.0 (also out of that context I would just update to 1.4.0 to rule out any issue related to that fixed bug).


As to your 2h screen record:
I suspect there’s still a misconception on your side: I (and I am quite sure also Audrius/others) do not doubt that there are problems with Syncthing in your setup. Let me repeat that: I do believe you, that you get unexpected behaviour by Syncthing. And unexpected behaviour is always bad and there are likely things to be improved in the code, UI and docs related to that behaviour. No need to try to hammer that point home any further.
Separately nobody has the time to watch a 2h screencast. That statement is blunt, but I hope understandable.
What we want/need, is either a clear reproducer, which requires a setup we can reproduce. Your entire production system is not reproducible for us. The other option is you debugging the entire thing yourself with guidance from us. That also needs reduction of the problem (which I’ll try at the end).


Then back to what you did, the problem is here:

The problem is the db reset on A and C but not B. Lets go through the process with an imaginary file “foo”:

  1. foo in sync on A, B and C with version {B:2, A:4} (whatever).
  2. Reset db on A and C: foo has now version {A:1, C:1} on A and C and the version above on B (not connected).
  3. Change from C to B: A and B compare foo and see the version conflict.

So now as to what might be able to be diagnosed:

That sounds like a problem already. At this point, stop… Really just that simple. Don’t add new problems, it will just make it harder to find out what went wrong here and anything following might just be a consequence of what is happening here. Let me write down the steps in my words the way I understood them:

  1. Reset db on A and B.
  2. Connect A and B, let them get in sync.
  3. Shutdown B, start computer C (but not Syncthing C).
  4. Reset db on C, then start Syncthing on C and let it sync with A.

Result: C does not get in sync with A.

Expected: C gets in sync with A.

Is this correct?

If yes, start by querying https://docs.syncthing.net/rest/db-file-get.html for one of the out-of-sync files on C and A and posting here.


And one more thing: If B and C can never be online at the same time, don’t directly connect them. There’s no point, they will never exchange information (because how should they) and thus look out-of-sync all the time to each other. Just both connect them to A and they will sync data with each other over A as they should.

2 Likes

Thank you, @imsodin! Your description is very systematic and easy to follow :slight_smile: Now I understand more about the versions and how they are affected by a reset; what to avoid and what steps to follow for better reliability. If A and B are introducers to each other, and A and C are also introducers, then B and C know about each other even if they can never meet. I thought it would be convenient because if I share a folder on one device, the others will offer me to accept it. But you’re right, there’s also a downside complicating the sync process. Querying the database will be very helpful to understand the problem. I’ll let you know as I have an update!