Skip to content

touch file early after upload to avoid having wrong time #13498

Closed

Description

@PVince81

When uploading a file from the sync client, the mtime is sent along.

After upload there is a short time window during which the final file still has the wrong mtime until touch() is created.

We need to look into making this happen earlier, to reduce the time during which the mtime is wrong (I don't think this can be eliminated properly, especially on external storages)

See owncloud/client#2252 (comment)

Activity

  1. added this to the milestone on Jan 20, 2015
  2. PVince81 commented on Jan 20, 2015

    @PVince81
    ContributorAuthor

    @DeepDiver1975 setting to 8.1

  3. VincentvgNn commented on Feb 9, 2015

    @VincentvgNn

    @PVince81
    On February 8th I installed a fresh instance of OC server 7.0.4, no encryption, had some files uploaded and downloaded them via a shared folder to a client on a Win 8.1 PC. Client 1.8.0-nightly (build 4536).
    Result: 328 files copied, 7 files with the wrong mdate (2% lost the original mtime)
    Downloading a file should be 100% prevented as long as the original mtime is not properly set at the server.

    Please have it solved quite soon!
    It's a kind of data corruption and it's one of the bugs that prevents me from releasing OC for my group of users.

  4. PeterPablo commented on Feb 9, 2015

    @PeterPablo

    This client issue is related (owncloud/client#2743, previously tracked in owncloud/client#2401).

  5. PVince81 commented on Feb 9, 2015

    @PVince81
    ContributorAuthor

    @VincentvgNn mind retesting with #13985 ?

  6. PVince81 commented on Feb 9, 2015

    @PVince81
    ContributorAuthor

    Looks like @DeepDiver1975 was faster, but his change is more extensive: #13823

  7. VincentvgNn commented on Feb 9, 2015

    @VincentvgNn

    @PVince81
    Just replacing one file. I can give it a try and test it.
    Please give me a sign and a link when your discussions have resulted in a testable file.

  8. PVince81 commented on Feb 9, 2015

    @PVince81
    ContributorAuthor

    @VincentvgNn yes, please hold. We might want to go with @DeepDiver1975's approach instead.

  9. karlitschek commented on May 4, 2015

    @karlitschek
    Contributor

    This would be "solved" with high level locking, right?

  10. PVince81 commented on May 11, 2015

    @PVince81
    ContributorAuthor

    Yes, by preventing concurrent requests to download the file while it is being worked on (protecting the final operations after upload which are "touch" and "rename" to the final file)

  11. 4 remaining items

  12. Repository owner unassigned on Sep 21, 2015
  13. ghost removed this from the milestone on Oct 5, 2015
  14. ghost added this to the backlog milestone on Oct 5, 2015
  15. PVince81 commented on Oct 29, 2015

    @PVince81
    ContributorAuthor

    Just tried on master / 9.0 pre-alpha, this is still an issue. Locking doesn't prevent that.

    Steps to reproduce

    1. Add sleep(10); here before touch: https://github.com/owncloud/core/blob/v8.2.0/lib/private/connector/sabre/file.php#L200
    2. Setup sync client
    3. Copy an old file with cp -a into the local data folder ("-a" makes it preserve its mtime)
    4. While the upload is running, use cadaver to do a ls repeatedly in the folder

    You'll see that the file's mtime is first the latest mtime and after 10 seconds it changes back to the correct one.

    I wonder if we can cover this simply by releasing the lock later @icewind1991 ?

  16. PVince81 commented on Sep 20, 2016

    @PVince81
    ContributorAuthor

    Still exists in 9.1.1RC3.

    Seems like even doing a touch earlier before the cache update solves it. But there is still a small time window before the renaming from part file to final file and the touch.
    Ideal would be to do the touch even before the rename, but might not work for the workaround case where there is either no part file or the part file is on a separate storage.

  17. removed their assignment
    on Jun 26, 2017
  18. ownclouders commented on Jan 13, 2018

    @ownclouders
    Contributor

    Hey, this issue has been closed because the label status/STALE is set and there were no updates for 7 days. Feel free to reopen this issue if you deem it appropriate.

    (This is an automated comment from GitMate.io.)

  19. PVince81 commented on Jan 15, 2018

    @PVince81
    ContributorAuthor

    In general the file's actual mtime on disk isn't that relevant. What matters is the value of storage_mtime.

    For external storages, if the mtime is wrong first it means a hasUpdated() call from another access will not sync the file as it has a future mtime before touch(). It isn't too bad, that shouldn't cause any negative side effects.

  20. lock commented on Jul 31, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  21. locked as resolved and limited conversation to collaborators on Jul 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions