Repository navigation
Description
Description
Uploading many files at one client and downloading (synchronizing) them at other clients leads to the loss of the modification date and time. It get's changed to the current date and time of the download.
The affected files are different for the clients that are downloading. So the date and time on the OC server are OK and it can be verified via the web UI as well.
This kind of change happens to about 1% of the files when simultaneously uploading and downloading many files.
For me the modification time is an important parameter that may never change until there is an intended change by one of the connected users.
Steps to reproduce
- Connect 3 client PC's, each with their own account to the OC server and use the web interface to let the Admin share a r/w folder with them.
The server should be somewhere else on the internet, e.g. at some web-host. - Copy a large amount of data (e.g. 500 MB, 3000 files, 300 folders) into the shared folder at client 1.
The copying to the shared folder at client 1 will take about 10 minutes and meanwhile the uploading to the server will start.
From the beginning on client 2 and 3 will start downloading the available files from the OC server. - Due to quite some interrupts, a slow server and the large amount of files things can go wrong. The whole process might take about 5 hours. Deliberately disconnecting the home network from the internet can help to generate errors, but that is often not needed.
- Use the home network and a file comparison tool like Beyond Compare to compare all files and folders with the original non-shared folder at client 1 where the the files were copied from. Next the results in the shared folders at all 3 clients can be checked for errors. I always use an independent comparison on CRC and modification time.
If client 2 and 3 do not have the same corrupted files, then the files are OK on the server. - For about 1% of the downloaded files at client 2 and 3 the file modification time will be corrupted and have the time of the moment of download. The affected files are quite random and different for client 2 and 3.
Example of an equal file and a changed modtime:

Expected behavior
The original modification time should never be changed by ownCloud.
Client configuration
ownCloud version: 1.6.3
Operating system: Win XP, Win 7 or Win 8
Browser: Google Chrome (or Firefox or IE11)
Server configuration
ownCloud version: 7.0.2 (stable)
List of activated apps: default apps + encryption
External storage: no
Encryption: yes
OC server installed at a Dutch webhosting company. 4-5 GB storage.
Control via DirectAdmin and installation by using Installatron.
Own (non-shared) IP and using https.
Operating system: Linux Hosting Package
Web server: Apache
Database: MySQL
PHP version: native, 5.5.
Activity
moscicki commentedon Sep 26, 2014
What happens with the mtime of the files on the server? Are these also "corrupted" or are they all good?
Secondly, have you tried to reproduce this scenario with 3 clients of the same user syncing a normal folder (non-shared one)? If you look at the server's implementation of sharing then hmm... everything's possible. I regularly see Shared files re-downloaded for no real reason (albeit with oc 5 server -- that may be very outdated sharing code on the server).
A possible bug in a client would show up due to some race conditions with the new propagator downloading in parallel or possibly in case of some interrupted transfer. However, given the fact the the mtime is part of the reply headers of server's response the second thing is less likely. You may rule out the first possibility by forcing all clients to use single-threaded propagator (either by bandwidth throttling in the Settings or by env variable OWNCLOUD_MAX_PARALLEL=1).
I would also try to rule out encryption from this picture.
I guess what would help the devs are the client logs for the files with incorrect mtime.
VincentvgNn commentedon Sep 27, 2014
@moscicki

I checked 2 files on the exact mtimes:
File 1:
mtime client 1: 15-02-2012, 15:56:34
mtime encrypted file on server: 15-02-2012, 15:56:34 (mtime is OK)
mtime client 3: 24-09-2014, 12:06:26
ctime client 1: 24-09-2014, 11:44:46
ctime encrypted file on server: 24-09-2014, 12:06:29
ctime client 3: 24-09-2014, 12:06:53 (24 sec from server to client 3 is quite short)
File 2:

mtime client 1: 5-12-2011, 19:04:00
mtime encrypted file on server: 5-12-2011, 19:04:00 (mtime is OK)
mtime client 3: 24-09-2014, 12:22:47
ctime client 1: 24-09-2014, 11:45:28
ctime encrypted file on server: 24-09-2014, 12:22:48
ctime client 3: 24-09-2014, 12:23:31 (43 sec from server to client 3)
At core issue #10975 I reported on Sept 12th a test with 3 clients on one Admin account, so no shared folders. There I found missing files on one of the clients. Unfortunately I did not record and keep all logging data. As far as a remember I got no files with the wrong mtime.
And if you talk about re-downloading files with shared folders, ......., I found a bunch of them. Up to 5% on Sept 22th at that same issue. I reported it there, but I'm aware that I have to create a separate issue for that.
The less features I use, the better things get. So I can rule out the encryption, but finally I want to use it in my users group. Besides ownCloud I have a website and a mail-system running at that same webhost on the same server, so I need the encryption just to make all files not too easy readable for those who do the website maintenance. And yes, I know that all needed for the decryption is unfortunately on the OC server.
When talking about race conditions and bandwidth throttling, yes lowering the speed at some places can help, but I'm getting nervous from bugs that always can pop-up again. So I don't want to hide them, but discover them by creating more difficult conditions.
Sooner or later the OC software should become more robust.
If needed, I will redo the test and let the full logging run on all clients.
dragotin commentedon Sep 29, 2014
Is it possible that the download requests of the files in question timed out? There have been problems with that. Can you check the apache access log?
moscicki commentedon Sep 29, 2014
Even if they did than I am still puzzled why mtime would not be set? Unless we are talking about the file that was not downloaded at all to the client (so @VincentvgNn sees old file content with old mtime). @dragotin: is this what you mean?
VincentvgNn commentedon Sep 30, 2014
File 1, I could trace down the following logged info:
File 2, I could trace down the following logged info:
@dragotin
Is this the right apache access log info that you asked for?
In the log file there were no more lines related to the specific 2 files during the next 12 hours..
So the whole timing seems to be logical and there were no time-outs or retries.
The error got at client 3 at just one first download.
Logging: Report setModTime failures.
VincentvgNn commentedon Nov 27, 2014
@ckamm
Update:
Some days ago I did a new test on file corruption.
On PC2 I found 1 file where the original mtime was lost. New mtime 23-11-2014.
On PC1 I found 2 other files where the original mtime was lost. New mtime 23-11-2014.
Conclusion: Between OC server 7.0.3 and OC client 1.7.0 the problem of loosing the original mtime still exists.
Test method:
Same data set as in previous tests: 500 MB, 3000 files, 300 folders.
OC server 7.0.3 at webhost
OC client 1.7.0 if it can work. (On Win XP OC client 1.7.0 does not work.)
3 PC's, each with an own account, connected to a shared folder, encryption was on.
dragotin commentedon Nov 28, 2014
Hmm, some clearifications:
So what happens is that the mtime that has to be set to the server file is transmitted as Header in the PUT request and the server is supposed to set it as atomar as possible. Maybe because of the encryption, there is a timegap between writing the file and making it visible to other clients and setting the timestamp.
@PVince81 @schiesbn any opinion on this?
PVince81 commentedon Nov 28, 2014
As long as there is no high level file locking (owncloud/core#11804), no operation will be really atomic.
Here is the code where the mtime is adjusted by touch: https://github.com/owncloud/core/blob/master/lib/private/connector/sabre/file.php#L144
After the part file is assembled, it will not be visible to other clients yet.
But as soon as the rename happens here https://github.com/owncloud/core/blob/master/lib/private/connector/sabre/file.php#L128 it will be available. Not sure if the rename itself could cause a delay, maybe if share keys are moved around.
PVince81 commentedon Nov 28, 2014
The rename + file_exist calls could also be slower if they happen on an external storage.
dragotin commentedon Nov 28, 2014
@PVince81 the question is: Is the file visible to other PROPFINDs after the file was assembled, but the timestamp was not yet adjusted? Note that moving of a file does not alter the modification time, so it should be fine to touch the file before the move happens - yet that might be not correct for external storage without posix move.
VincentvgNn commentedon Nov 28, 2014
@dragotin
There is no bandwidth limiting in the clients.
I have OC running at a webhost where the server hardware is as usual shared with (many) other customers. So for me the speed limitation is on the server side. Interrupts in the connection happen sometimes.
If needed I can make a timing analysis of the 3 latest November 23rd file samples where the original mtime was lost. In the same way as I did on 30-09-2014.
So ctimes on all 3 clients, ctime of the server file and timing as in the PUT (1x) and GET (2x) commands.
9 remaining items
guruz commentedon Jan 19, 2015
Moving to 1.9 while waiting for the server guys to reply.
VincentvgNn commentedon Jan 19, 2015
@guruz
On January 17th I found again an example of a file where the mtime was changed to the current time.
Meanwhile I'm using OC server 7.0.4 and OC client 1.8.0.4536-nightly20150108.
On the server I can also find some files like: "filename".ocTransferId1566750467.part. These remaining partial files are not cleaned-up. Maybe this is another issue?
PVince81 commentedon Jan 20, 2015
I just raised owncloud/core#13498 to address this on the server side.
VincentvgNn commentedon Jan 20, 2015
@PVince81
Thanks a lot for moving ahead with this issue.
PVince81 commentedon Feb 9, 2015
Experimental fix here: owncloud/core#13985
ogoffart commentedon Mar 23, 2015
Closing the client issue, it is being tracked on the server: owncloud/core#13498
VincentvgNn commentedon Mar 23, 2015
@ogoffart
OK to close it here.
I hope that issue 13498 will be solved in server 8.1 after introduction of the solution discussed at
owncloud/core#13823 .
Trello owncloud#2252 - Change status of conflicts from Error to Warning