Images synchronized using Syncthing appear corrupted.

I am using Syncthing v0.10.1 on Android & SyncTrayzor 1.1.18 on Windows(both are using Syncthing v0.14.41). I have setup Syncthing on both devices to synchronize Screenshots folder on my phone with a folder on my PC. But when I take a screenshot on my phone & view the corresponding file on my PC, it appears corrupted. It doesn’t sync properly from Android to Windows, since the synchronized image on my PC has a much smaller size than the original on my phone. The problem only occurs when I try to synchronize from Android to Windows, but not the other way around. Restarting Syncthing on Android fixes this issue fortunately i.e. The corrupt image gets replaced with proper one on restarting Syncthing, but it is quite annoying I have to do this every time. I have attached rar file of original & corrupted image.Screenshots.rar (170.2 KB)

Rescanning manually on android fixes it.

1 Like

After reading that post, I’m sure this bug has something to do with the Android version. I was using Syncthing on MiUI Lollipop 5.1.1 before & didn’t have this bug. Noticed this issue a short while after upgrading to AOSP Nougat 7.1.2. Definitely Syncthing Android bug, camera & screenshot images takes by Android are completely fine. No solution as of now I guess :frowning: except re-scanning it every time after an image is taken.

As Syncthing recently implemented inotify (currently in “beta”), this problem could be solved when the Android App switches from it’s inotify implementation to the integrated one. Or it will make things worse :wink:

I’m guessing “make things worse”, given that the root cause seems to be that the file is not “ready” when we go to read it. Someone with a device could test it, though.

Our implementation waits 10s before triggering a scan.

I was hoping the current implementation did that as well… if it doesn’t that might explain it, and the internal one should indeed work better.

Right, the Android app doesn’t do that. Will add it now.

I just test Syncthing v0.10.2 on Android & can confirm this bug has been fixed. Thanks a lot @Nutomic :smiley: