Skip to content

Data loss on rename of a 49 GB folder #13391

Closed

Description

@MorrisJobke

I accidentially renamed a folder on my production instance:

  • the folder was filled up with nearly 20k files in a total size of 48,7 GB
  • I renamed the folder in the web UI
  • shortly (2-5 seconds) after I noticed this I shut down the client to avoid bigger trouble (as this folder was set up as a synced folder inside the client)
  • the spinner spinned forever

Notes

  • I have a database dump here
  • I have all apache logs here
  • I have the owncloud.log here
  • I have a filesystem snapshot

If someone wants to help me with digging in the debris is welcome.

Access log:

The rename:

127.0.0.1 - - [15/Jan/2015:13:32:39 +0100] "GET /index.php/apps/files/ajax/rename.php?dir=%2F&newname=Bildersd&file=Bilder HTTP/1.1" 503 1216

The access log filtered for the folder Bilder:

...
127.0.0.1 - - [15/Jan/2015:13:24:36 +0100] "PROPFIND /remote.php/webdav/Bilder HTTP/1.1" 207 411
127.0.0.1 - - [15/Jan/2015:13:25:04 +0100] "PROPFIND /remote.php/webdav/Bilder HTTP/1.1" 207 411
127.0.0.1 - - [15/Jan/2015:13:25:34 +0100] "PROPFIND /remote.php/webdav/Bilder HTTP/1.1" 207 411
127.0.0.1 - - [15/Jan/2015:13:26:06 +0100] "PROPFIND /remote.php/webdav/Bilder HTTP/1.1" 207 411
127.0.0.1 - - [15/Jan/2015:13:26:39 +0100] "PROPFIND /remote.php/webdav/Bilder HTTP/1.1" 207 16662
127.0.0.1 - - [15/Jan/2015:13:27:36 +0100] "PROPFIND /remote.php/webdav/Bilder HTTP/1.1" 207 411
127.0.0.1 - - [15/Jan/2015:13:28:06 +0100] "PROPFIND /remote.php/webdav/Bilder HTTP/1.1" 207 411
127.0.0.1 - - [15/Jan/2015:13:28:36 +0100] "PROPFIND /remote.php/webdav/Bilder HTTP/1.1" 207 411
127.0.0.1 - - [15/Jan/2015:13:29:06 +0100] "PROPFIND /remote.php/webdav/Bilder HTTP/1.1" 207 411
127.0.0.1 - - [15/Jan/2015:13:29:36 +0100] "PROPFIND /remote.php/webdav/Bilder HTTP/1.1" 207 411
127.0.0.1 - - [15/Jan/2015:13:30:05 +0100] "PROPFIND /remote.php/webdav/Bilder HTTP/1.1" 207 411
127.0.0.1 - - [15/Jan/2015:13:30:34 +0100] "PROPFIND /remote.php/webdav/Bilder HTTP/1.1" 207 411
127.0.0.1 - - [15/Jan/2015:13:31:04 +0100] "PROPFIND /remote.php/webdav/Bilder HTTP/1.1" 207 411
127.0.0.1 - - [15/Jan/2015:13:31:36 +0100] "PROPFIND /remote.php/webdav/Bilder HTTP/1.1" 207 411
127.0.0.1 - - [15/Jan/2015:13:32:09 +0100] "PROPFIND /remote.php/webdav/Bilder HTTP/1.1" 207 16662

Nothing special in php-fpm.log or apache error log.

The folder is successfully renamed (in database and in the filesystem), but all database entries are gone (files are still there in the filesystem). Just a forced rescan with the occ command line tool was able to get them back into the database. Browsing the folder in the web UI didn't trigger the update of the file cache.

! For the user (without admin rights) it's not possible to get back the data from the server. It's simply not shown.

I will try to investigate further and try to reproduce.

cc @karlitschek @DeepDiver1975 FYI could get a showstopper soon - I opened this ticket to document my process

Activity

  1. self-assigned this
    on Jan 15, 2015
  2. MorrisJobke commented on Jan 15, 2015

    @MorrisJobke
    ContributorAuthor

    To clarify: the rename happend through the web UI

  3. PVince81 commented on Jan 15, 2015

    @PVince81
    Contributor

    127.0.0.1 - - [15/Jan/2015:13:32:39 +0100] "GET /index.php/apps/files/ajax/rename.php?dir=%2F&newname=Bildersd&file=Bilder HTTP/1.1" 503

    503 ? That's "service unavailable" and shouldn't even trigger an actual rename.

  4. PVince81 commented on Jan 15, 2015

    @PVince81
    Contributor

    You said you didn't have any other storages than home:: and the root, so this excludes the case of an unavailable external storage.

  5. MorrisJobke commented on Jan 15, 2015

    @MorrisJobke
    ContributorAuthor

    @PVince81 Yes. There is no external storage.

    Regards the 503: It's the only rename request and it definetly gets renamed. Could that be caused by the timeout?

  6. PVince81 commented on Jan 15, 2015

    @PVince81
    Contributor

    Not sure. Do you think php-fpm would decide to send 503 by itself when a timeout occurs ?

    If the server was not available / maintenance mode, our Sabre plugin should kick in very early and prevent any file operations.

  7. PVince81 commented on Jan 15, 2015

    @PVince81
    Contributor

    You could check the owncloud.log from around the time it happened (mind the timezone/utc differences)

  8. MorrisJobke commented on Jan 15, 2015

    @MorrisJobke
    ContributorAuthor

    I noticed that a rename caused a lot of database queries (600 for a folder with 507 files in it). It needs to update the path of all elements. I guess this caused the timeout and PHP-FPM will kill the process once the timeout is hit.

    https://blackfire.io/profiles/a33715d9-0191-4f9a-ad4a-2f3166d71584/graph

  9. MorrisJobke commented on Jan 15, 2015

    @MorrisJobke
    ContributorAuthor

    @icewind1991 What is the reason to store the full path? Isn't knowing the parent enough to generate the full path?

  10. removed their assignment
    on Jan 15, 2015
  11. MorrisJobke commented on Jan 16, 2015

    @MorrisJobke
    ContributorAuthor

    @DeepDiver1975 @karlitschek I would rate this a bit higher. I talk to @icewind1991 and he would like to come up with a partly improving change, but reducing the load (especially the SQL queries) in a way like it was done for the delete operation isn't possible for 8.0 (#13394).

    On the one hand this would require bigger changes but on the other hand this will cause critical problems (and even data loss) on renaming folders with many children.

    Is this rated a showstopper or not?

  12. icewind1991 commented on Jan 16, 2015

    @icewind1991
    Contributor

    @icewind1991 What is the reason to store the full path? Isn't knowing the parent enough to generate the full path?

    Yes, but most queries we do are by path

  13. MorrisJobke commented on Jan 16, 2015

    @MorrisJobke
    ContributorAuthor

    @icewind1991 I guess it scales better if you simply traverse the file tree. And you can cache this too. The current approach doesn't scale in any direction. :(

  14. PVince81 commented on Jan 19, 2015

    @PVince81
    Contributor

    I still don't understand why renaming a simple folder in place could run into a timeout (not even moving it to another location)
    Was that folder shared with many people ?

  15. 51 remaining items

  16. PVince81 commented on Jun 18, 2015

    @PVince81
    Contributor

    These two PRs together #17017 and #16963 make the problem disappear (with locking enabled)

  17. MorrisJobke commented on Jun 18, 2015

    @MorrisJobke
    ContributorAuthor

    @PVince81 @icewind1991 Thanks for this! You all rock :)

  18. beejee commented on Jun 22, 2015

    @beejee

    Hi,

    can it be that #15702 is related to this?
    I can test any changes/fixes you require me to execute to get you any feedback on this.

    Thanks!

  19. PVince81 commented on Jun 22, 2015

    @PVince81
    Contributor

    Not necessarily. This ticket here is about files randomly disappearing, it is not consistent.
    The ticket you linked against is about SWIFT.

  20. PVince81 commented on Jun 22, 2015

    @PVince81
    Contributor
  21. beejee commented on Jun 22, 2015

    @beejee

    Ah indeed, I responded too fast and only noticed after the difference after. I will build a testsetup with 8.1 to experiment with the filelocking and present some feedback on the other thread.

    Thanks.

  22. iGadget commented on Aug 3, 2015

    @iGadget

    So will the file locking solution also work when you rename a large folder and undo that rename within a few seconds? How would that work out?

  23. PVince81 commented on Aug 3, 2015

    @PVince81
    Contributor

    If you undo the rename while the operation is still in progress you will get a message like "folder is currently busy" and will need to try again later. If done through the sync client, the sync client will automatically retry later.

  24. PVince81 commented on Aug 3, 2015

    @PVince81
    Contributor

    On another note, @icewind1991 had a POC fix that should accelerate renaming of database entries: #13956

  25. simopal6 commented on Aug 24, 2015

    @simopal6

    Excuse me for intruding, but it is not clear to me if the problem still happens or not.

  26. alantygel commented on Dec 9, 2016

    @alantygel

    It just happened on my server.

    We are still using owncloud 8.0 . Upgrading to 9 will solve the problem?

  27. PVince81 commented on Dec 9, 2016

    @PVince81
    Contributor

    @alantygel yes, because OC 9 has some locking mechanism to avoid this kind of race conditions

  28. lock commented on Aug 3, 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.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions