fix(dav): Prevent race condition in useDAVFiles#2511
Open
DerDreschner wants to merge 1 commit into
Open
Conversation
Assisted-by: ClaudeCode:claude-fable-5 Signed-off-by: David Dreschner <david.dreschner@nextcloud.com>
Author
|
@susnux : Please review, I have no rights on the |
susnux
reviewed
Jul 14, 2026
Comment on lines
+101
to
+104
| if (abortController === thisAbortController) { | ||
| abortController = undefined | ||
| isLoading.value = false | ||
| } |
Contributor
There was a problem hiding this comment.
I wonder if this can not just be simplified in general to only this change:
if (abortController && abortController.signal.aborted) {
abortController = undefined
isLoading.value = false
}
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.
This PR fixes a race condition that occurs under high load in our CI runners using playwright.
Here is a summary of the issue that Claude created:
Root cause (confirmed end-to-end)
A race in
@nextcloud/dialogs'useDAVFiles(lib/composables/dav.ts).loadDAVFilesaborts the previous load and starts a new one, but the aborted load'sfinallyblock unconditionally ran:So when fast navigation supersedes a load, the aborted one flips
isLoadingback tofalsewhile the newer load is still in flight andfolderis stillnull. InFilePicker.vue, the confirm button is only disabled whileisLoading— so in that window it's enabled withcurrentFolder = null, and confirming yields an empty selection →pickNodes()throwsFilePickerClosed("No nodes selected")→moveOrCopyActioncatches it as "user cancelled" → no COPY is ever sent → the test'swaitForResponsehangs to the timeout. On a fast machine the load wins the race (passes); under load (0.2 CPU / slow CI) the abort wins (fails). That's exactly the.movfailure — and why it's intermittent and file-agnostic.Fix (branch
fix/race-conditionsinnextcloud-dialogs)lib/composables/dav.ts— capture this invocation's controller and only clear shared state if it's still the current load:Now a superseded load leaves
isLoadingtrue until the real load finishes, so the FilePicker never confirms with a null folder. Added a regression test indav.spec.ts("a superseded (aborted) load does not clear the loading state of the newer load").🤖 AI (if applicable)