Skip to content

Cannot run versions hook, file is locked #16900

Closed

Description

@PVince81

Steps

  1. Enable experimental files locking
  2. Using cadaver, PUT a small text file (generated from https://baconipsum.com)
  3. PUT it again to overwrite it

Expected result

No errors in log.
Version properly created.

Actual result

{"reqId":"EVhVN+4pQUfs13GXLu4y","remoteAddr":"127.0.0.1","app":"hook","message":"error while running hook (OCA\\Files_Versions\\Hooks::write_hook): folder\/bacon.txt is locked","level":3,"time":"2015-06-12T11:19:41+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/folder\/bacon.txt"}

No version created.

@icewind1991 something wrong with locking and hooks.
Should we rewrite files_versions to use storages instead of of views ?

Activity

  1. PVince81 commented on Jun 12, 2015

    @PVince81
    ContributorAuthor

    Observed on master (cda9685)

  2. added this to the milestone on Jun 12, 2015
  3. PVince81 commented on Jun 12, 2015

    @PVince81
    ContributorAuthor

    Does not happen when overwriting file in the web UI.
    Also does not happen with big files (chunking).

    This means this is the code path for WebDAV PUT of small files, the one that has specific/explicit locking code and does not go through the view.

    I'll have a look.

  4. self-assigned this
    on Jun 12, 2015
  5. PVince81 commented on Jun 12, 2015

    @PVince81
    ContributorAuthor

    The exception happens in a pre-hook, where Storage::store() for the versions is called to copy the current file to a version. This happens before the final rename.

    Maybe the lock should be made a shared lock first and exclusive only before the rename, after the prehooks. I believe this is what we already do in the view.

    I'll have a try.

  6. PVince81 commented on Jun 12, 2015

    @PVince81
    ContributorAuthor

    PR will arrive soon. Struggling with unit tests.

  7. PVince81 commented on Jun 12, 2015

    @PVince81
    ContributorAuthor

    Fix is here #16912

  8. locked as resolved and limited conversation to collaborators on Aug 11, 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