Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syncthing-android updates file modification times on initial sync #69

Closed
lfam opened this issue Jul 31, 2014 · 23 comments

Comments

Projects
None yet
9 participants
@lfam
Copy link

commented Jul 31, 2014

I am having an issue where Syncthing-android resets file modificaiton times to the time of initial sync on the Android device. These modification times are propagated through the cluster. I consider this a data loss.

My cluster consists of four machines:
android 0.4.3 syncthing v0.8.20 (this project)
darwin-amd64-v0.8.21
linux-armv7-v0.8.21
linux-amd64-v.0.8.21

Here is how I reproduce this bug.

I stop syncthing on every machine in the cluster. I rm ./* from within the repo directory on each machine. Now the repo exists but is completely empty. Then, I rsync -a my files into the repo of one machine (specifically, the darwin v0.8.21) from a backup. These files have diverse modification times.

When I start the cluster without the android machine, the files sync normally, propagating the correct modification times to each machine in the cluster.

When I add the android machine with an empty repo, it syncs the files from the cluster to itself, but it erroneously updates the modification time of the received files to the present time. These updated modification times are then propagated to the rest of the cluster.

Modification times are important information to me and I don't think it's normal behavior to update them when syncing.

Please let me know if I can provide any logs or debug traces to assist you.

@MStrecke

This comment has been minimized.

Copy link
Contributor

commented Jul 31, 2014

This sounds like a problem we had before, which prompted the "ignore permission" option.
Have you tried this option on the android side?

There is nothing this project can do, because it only provides a wrapper around the syncthing binary, which does the transfer and writing and reading of files, permission and modification dates.

Which android version do you use?

@Nutomic

This comment has been minimized.

Copy link
Member

commented Jul 31, 2014

@calmh This is for you ;)

@MStrecke "ignore permissions" is set automatically on Android, and can't be changed

@lfam

This comment has been minimized.

Copy link
Author

commented Jul 31, 2014

I am using Android 4.4.4. It's not rooted or anything exotic like that.

And yes, I can confirm that "Ignore permissions" is set.

Should I close this issue and refile it at the main Syncthing repo?

@calmh

This comment has been minimized.

Copy link
Member

commented Aug 1, 2014

Sounds like syncthing can't set the modification times at all on the android side, thus when it scans for modifications after the first sync it thinks all the modification times have changed. Does (this instance of) Android not support modification times on it's filesystem?

@Nutomic

This comment has been minimized.

Copy link
Member

commented Aug 1, 2014

Works for me:

$ touch test                                         
$ ls -l
-rw-rw---- root     sdcard_r        0 2014-08-01 10:38 test
$ touch test
$ ls -l
-rw-rw---- root     sdcard_r        0 2014-08-01 10:39 test

@lfam What's your output for these commands? (with some waiting between the touch)

@lfam

This comment has been minimized.

Copy link
Author

commented Aug 1, 2014

Here it is.

$ ls -l test
test: No such file or directory
$ touch test
$ ls -l test
-rw-rw---- root     sdcard_r        0 2014-08-01 10:39 test
$ touch test
$ ls -l test
-rw-rw---- root     sdcard_r        0 2014-08-01 10:40 test
@lfam

This comment has been minimized.

Copy link
Author

commented Aug 1, 2014

@calmh This instance of Android is version 4.4.4 running on a Nexus 4, so it is about as plain as you can get. Straight from Google.

@calmh

This comment has been minimized.

Copy link
Member

commented Aug 2, 2014

Then I don't know. Is there some difference with syncthing not running as root (I assume it doesn't)? Does it log something useful when syncing?

@lfam

This comment has been minimized.

Copy link
Author

commented Aug 3, 2014

How can I access logs for the Android client?

Then I don't know. Is there some difference with syncthing not running as
root (I assume it doesn't)? Does it log something useful when syncing?


Reply to this email directly or view it on GitHub
#69 (comment)
.

@Nutomic

This comment has been minimized.

Copy link
Member

commented Aug 3, 2014

The logs should be posted to logcat (use adb logcat -s SyncthingNativeCode:v).

If you have root, you could also do cd /data/data/com.nutomic.syncthingandroid/lib and then follow the debugging instructions.

@Nutomic Nutomic added bug labels Aug 3, 2014

@lfam

This comment has been minimized.

Copy link
Author

commented Aug 5, 2014

I haven't taken the time to set up adb yet, but I did try putting the repository in syncthing-android's private storage (/data/data/com.nutomic/syncthingandroid/files) rather than the sdcard (/storage/emulated/0).

I don't have this issue when the files are stored in /data/...

@lfam

This comment has been minimized.

Copy link
Author

commented Aug 8, 2014

Are you sure this is right?
adb logcat -s SyncthingNativeCode:v

When I run it, all I get is...
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
...regardless of what is happening with the Syncthing app.

When I run adb logcat *:V, the string SyncthingNativeCode never appears.

Forgive me if I'm missing something obvious. This is my first time using adb.

@Nutomic

This comment has been minimized.

Copy link
Member

commented Aug 10, 2014

Looks like the logging is broken, I hope I can try and fix it soon.

@Nutomic

This comment has been minimized.

Copy link
Member

commented Oct 12, 2014

Logging works again (even with a setting for STTRACE), so you could try and collect some logs now.

@Nutomic

This comment has been minimized.

Copy link
Member

commented Oct 13, 2014

I guess this will be solved with syncthing/syncthing#831

@AudriusButkevicius

This comment has been minimized.

Copy link
Member

commented Jan 20, 2015

So this is not solved because updating mtime does not work in the sdcard, only in the built-in storage, hence the issue.

Unless someone can prove my argument wrong?

@Nutomic

This comment has been minimized.

Copy link
Member

commented Jan 20, 2015

Right.

We once talked about having a database of change times within syncthing. But I suppose this wasn't implemented yet (and may also not be worth the effort).

@calmh

This comment has been minimized.

Copy link
Member

commented Jan 20, 2015

It is probably worth the effort, there's been some thinking and I think we'll implement it somehow soon. But no, not there yet.

@pmontrasio

This comment has been minimized.

Copy link

commented Feb 6, 2015

I got here because I have a related problem and discussing it here might help finding a common solution.

I sync a collection of almost 50k small files (2.90 GB) to a Galaxy S2 (Android 4.0.3) and a Galaxy Tab S 8.4 (Android 4.4.2). I add about 50 new files per week to the collection on my PC (Ubuntu 12.04) and sync them to the internal storage of the two mobile devices. The PC is the folder master.

All is well on the tablet but there is something that changes the modification times of files on the phone (maybe some system indexing process) so the PC ends up sending more than half of the files to the phone every week. I'd love a per folder option to ignore the modification time. This might mean that changes that don't alter the size of the files would go unnoticed (I didn't check the algorithm) but that would be OK for me in this scenario. The database of change times would be a better solution but (maybe) harder to implement.

@TiZ-EX1

This comment has been minimized.

Copy link

commented May 10, 2015

I have a problem that may or may not be tangentially related, so I would like to check in here before opening a new issue. Syncthing on my Android device (rooted S4, 4.4.2) has a tendency to push old files and overwrite newer files. Does that have any relation to this issue?

@Zillode

This comment has been minimized.

Copy link
Member

commented May 10, 2015

@TiZ-EX1 yes, it does

@TiZ-EX1

This comment has been minimized.

Copy link

commented May 10, 2015

Thanks. I'll be watching this issue closely, then.

@Nutomic

This comment has been minimized.

Copy link
Member

commented May 17, 2015

This should be fixed in 0.6.1

@Nutomic Nutomic closed this May 17, 2015

@syncthing syncthing locked and limited conversation to collaborators Nov 9, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.