client 1.4 unnecessarily downloads again those files which are already downloaded
A user shared with me a folder with about 10 10 GB data (approx. 200 files).
I don't know why, but it's often (not always) finding some new files. Download follows - but unnecessarily: files are absolutely identical (byte comparison); the file on server hasn't been touched for months. So the file hasn't changed.
Following suggestions:
- Finding and fixing the reason why the client trys to re-download equal files which hasn't been changed/updated in any way
- Before downloading files: download a hash of the file from server for that file + check if hash can be found in local journal database + if yes: copy the file locally
Local client: 1.4.0 on Win2008 R2 server (and other win systems, too) Server version: 4.5.7 on Linux
I can confirm this issue against Server 5.0.10.
Please let me know what information I can give you to further track down this error. I am seeing this regularily on my install.
maybe related: #110
this bug is critical to me since lot of traffic happens due to this issue (>30 GB per month!) my last ISP already kicked me a few weeks ago because I had too much traffic with my internet flat rate. I don't want to retry this procedure again... ;-)
Might be related: I just noticed that my client also decided now to re-download everything (in the menu opening up when clicking on the "tray" icon in my ubuntu 13.04, it wrote "downloading file .. of .., xx of yy MB or something like that - and showing all the 950MB of the one synced folder, so it seems to just re-download everything!) - no idea why, there were no big changes to files recently, no server upgrade (still running 5.0.10), no client upgrade (apart from 1.4, but that was last week already or so and the client has run multiple times since then already).
So I really have no clue at all why the client is redownloading anything. Any logfile I could check (I heard the client now also produces a logfile if not explicitly started with the logging option)? I guess its also no option to restart I the client, not sure if he will exhibit the same behavior, but I will try...
Edit: Restarted the client with logwindow option, and the sync continued to download files I think (at least the Recent changes show something like that). Can provide the logfile on request (don't like to post it publicly with all the document references).
Is it maybe now a good time to think again about introducing proper file checksums instead of the random tags? What was again the argument against using it? High CPU usage? If it can prevent issues such as this, where unmodified files are downloaded multiple times, this argument doesn't hold. Calculating a checksum once can't possibly cost more CPU performance than re-downloading the same things multiple times (and if the argument is for the server side, then the re-downloading possibilities can even be multiplied with more clients!)
Please everybody, can you please post me the result of the following SQL-Statements run on server database:
select count(*) from oc_filecache where etag = '';
select count(*) from oc_filecache;
@RandolfCarter pls. send the full, zipped logfile to freitag at owncloud.com, thanks.
37 without etag, 7790 with.
The 37 are all files within zip files (.../file.zip/...) plus a directory. These are not the files I observed to be redownloaded.
The client seems to do repeated uploading too. Is this related? Same server version, same client version. OS - Gentoo both side. PHP 5.5, Apache 2.4, MariaDB 5.5.
An update, I just added another computer to a folder, which is already synced at a two other hosts. As expected, the new system integrated itself fine. The new system used a blank directory to start its work from.
However, one of the two other systems started to download approximaltely 85% of the files (2.700 files, 1.1 GB) after I booted the system about half an hour later. None of the files have been changed, since the download on the new system.
I have launched a log window during synchronisation, the general pattern seems to be like this:
09-15 15:25:22:087 oc_module: => open called for ownclouds://loremipsum/remote.php/webdav/Documents/file.txt
09-15 15:25:22:087 oc_module: GET request on /remote.php/webdav/Documents/file.txt
09-15 15:25:22:087 oc_module: Sendfile handling request type GET. fd 3
09-15 15:25:22:087 oc_module: -- GET on ownclouds://loremipsum/remote.php/webdav/Documents/file.txt
09-15 15:25:22:204 oc_module: Content encoding ist
If you want the full log untli the end of the sync, please let me know, I have saved it. However, I did not catch the start of the sync. If that is neccessary, please let me know, then I'll change my client systems to permanent logging. As well, if you want to take a peek into the server logs (both oc internal and Apache access log), I have them available for inspection. Just drop me a mail to torben
While trying to investigate #1003, I again got addidional downloads. What I did (Win 7/64 Pro, Client 1.4):
- Create a folder ("New Folder", which got renamed to "GCA Data Sets", see #1003 for troulbes)
- Copied a few files into it from another folder within the same sync directory.
- Did this twice.
- After the rename I did in #1003, it synchronized the complete folder which contained a few of the files I synced.
I used Windows Explorer for this.
I'll change my clients now so that they continously create log files. Maybe this gives us some insights.
Are the server logs helpful here, or are the client logs sufficient?
What i had just now:
Several log messages around "stat failed for /var/www/clients/client1/web27/private/somefile" (Why can't I just copy/past from the log view in the web, this is really irritating...)
At least right now the file in question exists and has the correct permission set.
Again, after a client restart, I got a few dozen files downloaded again without reason. I have zipped together the logs of the individual sync runs the client made, the oc server log and the oc apache access log. Please mail me at torben
http://s.nehmer.net/eSxI6oR2rC
Note, that this is reproducible her. The number of files getting downloaded again and again is increasing (right now he sucks down 629 files wtih 200 MB needlessly).
Another thing to look out, unsure if this is related: Right now I realized (by coincidence) that I had two owncloud.exe instances running (one of it did not show a tray icon, otherwise I'd have noticed it earlier). I cannot say for sure, if this influences things. If it does, you might want to include a check to avoid duplicate program launches.
@torbennehmer We already have a check for double instances. If another instance was running, it did not respond and thus was dead anyway.
@danimo: That check is buggy, see #1004, it is easily possible to launche two instances in case you have different command line. I am unsure how long the multiple instances were running here, though I am fairly certain that most of the problems I experienced were before the second instance came up.
@dragotin Executing your SQL statement doesn't work for me since I use older server version 4.5.7 table oc_filecache doesn't exist if I use table oc_fscache, column etag doesn't exist Please advise what I can do for you to get information as needed.
Hey there folks.
I also have a similar issue where files are synced over and over again even tho they didn't change.
However, in my log, I've found something quite suspicious.
09-16 07:06:27:332 _get_md5: MD5 for [server]/[file]: 5236e6f7dcdd7-gzip
Now, the -gzip at the end is just weird because in my oc_filecache table, the MD5 is just 5236e6f7dcdd7, so it's normal that everytime the client tries to sync this file, it thinks it's a different one. Why would that -gzip be there at the end of the md5?
Please advise what I can do for you to get information as needed.
@jochenwezel back in 4.5 the etag was stored in oc_properties with the propertyname {DAV:}getetag
You need to join the tables while querying. Unfortunately I have no 4.5 instance at hand at the moment - sorry
@jochenwezel please update anyway!
A question: Assuming that the time of one client was 3-4 seconds in the future compared to the other hosts and the OC server: Could that explain the bahavoir?
I am not sure here, I had a clock skew at least for a moment between my MacBook and the OC server (both of which are NTP synced, the server time is valid), once I started to investigate however, the skew vanished and I am quite unsure, how (maybe because I opened the Date & Time settings on the MacBook).
Here are a few exceprts of the log of the sync run (a fresh client start), I grepped for a specific filename in the log. As always, if you need a complete log, please drop me a PM.
09-16 20:28:34:432 csync_ftw: Uniq ID from Database: Word/templates/Torben Nehmer - Einseitig.dot -> 5235c4f5bfad3
09-16 20:28:34:432 csync_walker: file: /Users/torben/Documents/Word/templates/Torben Nehmer - Einseitig.dot
09-16 20:28:34:432 _csync_detect_update: ==> file: Word/templates/Torben Nehmer - Einseitig.dot - hash 18407479296867747143, mtime: 1272913023
09-16 20:28:34:432 _csync_detect_update: Database entry found, compare: 1272913023 <-> 1272913023, md5: 5235c4f5bfad3 <-> 5235c4f5bfad3, inode: 8202737 <-> 8202737
09-16 20:28:34:432 _csync_detect_update: file: Word/templates/Torben Nehmer - Einseitig.dot, instruction: INSTRUCTION_NONE <<=
...
9-16 20:28:35:124 oc_module: owncloud_stat ownclouds://owncloud.nehmer.net/remote.php/webdav/Documents/Word/templates/Torben Nehmer - Einseitig.dot called
09-16 20:28:35:124 csync_walker: file: ownclouds://owncloud.nehmer.net/remote.php/webdav/Documents/Word/templates/Torben Nehmer - Einseitig.dot
09-16 20:28:35:124 _csync_detect_update: ==> file: Word/templates/Torben Nehmer - Einseitig.dot - hash 18407479296867747143, mtime: 1272913023
09-16 20:28:35:124 _csync_detect_update: Database entry found, compare: 1272913023 <-> 1272913023, md5: 5236b9d89d2db <-> 5235c4f5bfad3, inode: 0 <-> 8202737
09-16 20:28:35:124 _csync_detect_update: file: Word/templates/Torben Nehmer - Einseitig.dot, instruction: INSTRUCTION_EVAL <<=
...
09-16 20:29:15:396 _csync_merge_algorithm_visitor: INSTRUCTION_NONE file: Word/templates/Torben Nehmer - Einseitig.dot
...
09-16 20:29:15:505 _csync_merge_algorithm_visitor: INSTRUCTION_SYNC file: Word/templates/Torben Nehmer - Einseitig.dot
...
09-16 20:38:22:947 oc_module: => open called for ownclouds://owncloud.nehmer.net/remote.php/webdav/Documents/Word/templates/Torben Nehmer - Einseitig.dot
09-16 20:38:22:947 oc_module: GET request on /remote.php/webdav/Documents/Word/templates/Torben%20Nehmer%20-%20Einseitig.dot
09-16 20:38:22:948 oc_module: Sendfile handling request type GET. fd 34
09-16 20:38:22:948 oc_module: -- GET on ownclouds://owncloud.nehmer.net/remote.php/webdav/Documents/Word/templates/Torben Nehmer - Einseitig.dot
09-16 20:38:22:957 FolderWatcherPrivate::callback by OS X
09-16 20:38:23:052 oc_module: Content encoding ist <empty> with status 200
09-16 20:38:23:098 oc_module: GET http result 200 (OK)
09-16 20:38:23:098 oc_module: http request all cool, result code 200
09-16 20:38:23:098 oc_module: ** Finished download ownclouds://owncloud.nehmer.net/remote.php/webdav/Documents/Word/templates/Torben Nehmer - Einseitig.dot
09-16 20:38:23:100 oc_module: Get file ID for ownclouds://owncloud.nehmer.net/remote.php/webdav/Documents/Word/templates/Torben Nehmer - Einseitig.dot: 5236b9d89d2db
09-16 20:38:23:100 _get_md5: MD5 for ownclouds://owncloud.nehmer.net/remote.php/webdav/Documents/Word/templates/Torben Nehmer - Einseitig.dot: 5236b9d89d2db
09-16 20:38:23:100 _csync_push_file: FINAL MD5: 5236b9d89d2db
09-16 20:38:23:100 _csync_push_file: PUSHED file: /Users/torben/Documents/Word/templates/Torben Nehmer - Einseitig.dot
...
09-16 20:38:25:542 _merge_file_trees_visitor: PRE UPDATED Word/templates/Torben Nehmer - Einseitig.dot: 5236b9d89d2db
09-16 20:38:25:542 _merge_file_trees_visitor: file: /Users/torben/Documents/Word/templates/Torben Nehmer - Einseitig.dot, instruction: UPDATED (5236b9d89d2db)
...
09-16 20:38:26:632 _insert_metadata_visitor: SQL statement: INSERT INTO metadata_temp
(phash, pathlen, path, inode, uid, gid, mode, modtime, type, md5) VALUES
(-39264776841804473, 44, Word/templates/Torben Nehmer - Einseitig.dot, 8205832, 501, 20, 33188, 1272913023, 0, 5236b9d89d2db);
@DeepDiver1975 @dragotin Coming back to my server instance with V4.5.7, I've adapted your SQL statements as well as possible to me in time - here my results:
select count(*) from oc_properties where propertyname = "{DAV:}getetag"
=> 2621
select count(*) from oc_fscache
=> 1588
Sorry, I don't know how to join both tables correctly - following statement doesn't provide at least 1 row :-/
select * from oc_fscache
inner join (select * from oc_properties where propertyname = "{DAV:}getetag") as etags
on oc_fscache.user = etags.userid and oc_fscache.path = etags.propertypath
If required furthermore, you may provide an optimized sql statement