Marker disappearing in versioning setup

Hello, I’ve been using a simple versioning setup with the versioning folder itself also synced back between the two devices for a few years without issue. The problem is the versioning folder marker has began disappearing randomly (only on the second device,and only the marker, no other data loss) and the syncing stopping. Any idea?

It’s really unclear what you mean exactly, as there is no marker when it comes to versioning. .stfolder is the folder marker, but that’s unrelated to versioning. Can you post screenshots of the Syncthing Web GUI with the error messages visible?

Device A (source of data)
Device B (simple versioning)
.stversions on Device B also independently synced back to Device A, so it has a .stfolder (which now keeps disappearing)

Ah, so you’re trying to sync the versions folder itself. This should normally work fine though. Do you use any kind of “cleanup” software on Android that could possibly automatically remove empty folders? Also, I remember seeing a related issue where version cleanup itself would remove the marker, but that issue was supposed to be fixed a long time ago.

One possible scenario that I can imagine is the following.

  1. Syncthing-Android creates the .stfolder folder marker with an empty text file inside it to prevent cleanup software from deleting it.
  2. Version cleanup removes the empty text file.
  3. Cleanup software removes the now empty .stfolder.

Most likely the cleanup of the version directory removes .stfolder because it’s an empty directory. I expect that putting a file in that dir would prevent it, and that file in turn shouldn’t be removed if it isn’t a version of something according to the naming scheme of the simple versioner…

Can confirm adding a simple .keep empty file inside the .stfolder is preventing it from being cleaned up.

Right, the root cause of this is likely some overly obsessive clean up by your android version, but I am a bit surprised - I think my android syncthing automatically puts a dummy file in there to prevent just that from happening and this feature has been there since forever.

Why didn’t that work for you :thinking:

That really i don’t know. What i do know is that this setup has been working without issue across two phones for around five years (LG G4 → Oneplus 6). A few weeks ago, this issue popped up seemingly randomly on the OP (no OS updates, no major changes). Then a few days ago i finally ended up retiring my OP6 cause it was getting really slow for today’s standards and got a Xiaomi 12T Pro, and figured out this issue would disappear by itself but to my surprise it didn’t.
Also, this has not been happening to any of the many other .stfolder’s that are present in my configuration, only the one inside .stversions was affected, so in my opinion it’s not the fault of an overly zealous OS cleaning feature.

There’s two different things. We put a file in .stfolder to prevent it from getting deleted by Android cleanup stuff. But we clean .stversions ourselves, when configured to do so, and we don’t expect an .stfolder in there…

Got it. So being that this setup is not officially “supported”, what would you suggest to achieve the same result? As in, the same versions history available on both devices. I thought this was a neat trick at the time and it did its job for a long time.

I think this should still work fine. The main culprit appears to be the phone software that “cleans” empty folders indiscriminately. I’d suggest to simply disable the cleanup in Android settings, of course if even possible. There is no performance or any other benefit in such cleanup anyway.

We just came to the conclusion that it’s Syncthing-Android itself that is removing the folder, hence why i said not officially “supported”.
The trick of manually adding an empty file is still perfectly valid, but i was wondering if there was another, cleaner way of achieving this setup after all.

I’ve done a little investigation, and it seems that this used to work fine in the past when .stfolder was still a file and not a folder (at least with Simple and Staggered versioning). It doesn’t work anymore, because empty folders are removed with no exception by the version cleanup routine. I think it may be a good idea not to remove Syncthing internal files/folders at least in the root of the versions folder.

The trick with an empty file does work though, with the exception of Trash Can versioning which happily deletes both the file and the folder :upside_down_face:.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.