fix(files_versions): avoid version snapshot races during cross-storage renames#61254
Open
joshtrichards wants to merge 1 commit into
Open
fix(files_versions): avoid version snapshot races during cross-storage renames#61254joshtrichards wants to merge 1 commit into
joshtrichards wants to merge 1 commit into
Conversation
…orage renames Signed-off-by: Josh <josh.t.richards@gmail.com>
Member
Author
|
Example failure from an actual CI run (https://github.com/nextcloud/server/actions/runs/27333716311/job/80752712482?pr=61185): There was 1 error:
1) OCA\Files_Trashbin\Tests\StorageTest::testKeepFileAndVersionsWhenMovingFileBetweenStorages
RuntimeException: Failed to copy to files_versions/test.txt.v1781170610 from cache with source data {...}
/home/runner/actions-runner/_work/server/server/lib/private/Files/Cache/Cache.php:1262
...
/home/runner/actions-runner/_work/server/server/apps/files_versions/lib/Versions/LegacyVersionsBackend.php:163
/home/runner/actions-runner/_work/server/server/apps/files_versions/lib/Versions/VersionManager.php:96
/home/runner/actions-runner/_work/server/server/apps/files_versions/lib/Storage.php:217
/home/runner/actions-runner/_work/server/server/apps/files_versions/lib/Listener/FileEventsListener.php:210
/home/runner/actions-runner/_work/server/server/apps/files_versions/lib/Listener/FileEventsListener.php:83
...
/home/runner/actions-runner/_work/server/server/apps/files_trashbin/tests/StorageTest.php:507 |
Member
Author
|
/backport to stable34 |
Member
Author
|
/backport to stable33 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cross-storage moves already have dedicated version handling via
VersionStorageMoveListener, which handles moving existing versions across backends.At the same time,
FileEventsListener::write_hook()can still callStorage::store()while that move is in progress. For moves between backends, that is redundant and can race with the move flow by snapshotting the source path while it is already being moved.Changes:
FileEventsListenerStorage::store()inwrite_hook()for writes under those pathsI found this while investigating intermittent failures in
apps/files_trashbin/tests/StorageTest.php::testKeepFileAndVersionsWhenMovingFileBetweenStorages. The existing test already covers the affected scenario; the problem is the race in the implementation, not missing scenario coverage.Possible user-visible symptoms:
Checklist
3. to review, feature component)stable32)AI (if applicable)