prevent concurrent fetches between user and status indicator checks#6141
prevent concurrent fetches between user and status indicator checks#6141shiftkey merged 7 commits intodevelopmentfrom
Conversation
…s that need to perform fetch
| this.updateMenuItemLabels(repository) | ||
| this._initializeCompare(repository) | ||
| this.refreshIndicatorsForRepositories([repository]) | ||
| this.refreshIndicatorsForRepositories([repository], false) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
This seems like a step in the right direction here.
This seems like expected behavior as a user. My hierarchy of things I care about is definitely whatever is happening in Push/Pull first, much more so than the background ops of repo indicators - it's fine for them to update during the next background operation.
I'm not positive I understand what you mean by this. What will the button show differently? Does it interfere with the fetch/push/pull op? More generally, I think you're aligned with this, but since this has been an issue since 1.3, I think it's ok to release in 1.6 or 1.5.1 from a prioritization perspective. |
|
@billygriffin yeah, this isn't something I planned to pull in for 1.5.0 - I just wanted to open this PR early so I can work through the impact (race conditions are great)! |
@billygriffin our normal fetch/push/pull flow will take the progress reported by Git and display it in the toolbar button. We do this for two reasons:
It's that second point that I believe is relevant here, because of how the app can arbitrarily run a fetch in the background (with no feedback to the user). If we don't check for an in-flight fetch/push/pull operation in the background, and the fetch can take a while due to slow network or complex repositories, the likelihood of concurrent fetches increases significant. |
|
Tentatively scheduling this for |
|
Marking this one as |
outofambit
left a comment
There was a problem hiding this comment.
This seems like a reasonable next step to me. I'm still wrapping my head around some of the related internal logic outside of the PR, but general 👍 from me
|
anyone else from @desktop/engineering want to weigh in? |
|
@shiftkey Any specific that needs to be tested here? I am not sure how to simultaneously trigger two or more of the outlined actions. |
|
@tierninho it's kind of tricky because the background fetch doesn't really have any UI, and you'll see this message after it's completed: desktop/app/src/lib/stores/app-store.ts Lines 1969 to 1973 in ba999a3 This also forces the background fetcher through desktop/app/src/lib/stores/app-store.ts Lines 1286 to 1293 in ba999a3 Maybe just trying to fetch regularly in the app to see if you can force the background fetcher to trip at the same time as your manual fetch? |
|
Merging this in so that it's available as part of the first beta |
|
You need to update the reference using following Git command on Git bash: [locked branch name] is the name of the branch that the error is happening because of mismatch of commit Ids. |
Overview
This PR does some tidy up around how our background fetching from #4770 integrates with other operations and hopefully resolves these reported issues:
Fixes #6121
Fixes #5438
Fixes #5328
Description
When we initially rolled out #4770 the goal was to be able to fetch in the background without the user knowing (or needing to care about errors). That's why we originally went through
GitStoreto perform the fetch - but this avoidedwithPushPullwhich checks and prevents concurrent push/pull/fetch operations.This seemed fine for the most part, but I believe this has left us open to a race condition with concurrent fetches, where the user starts a fetch at the same time as the repository indicator updater is fetching the same repository, or vice versa.
I stumbled across microsoft/vscode#47141 earlier today where VSCode basically outlined this behaviour between itself and an extension, and this comment comes to the same conclusion about what I believe is happening to these users:
It's hard to see from the reported issues which Git operation was the one that failed, but I believe it can be tripped with just a fetch (
pullalso performs afetchto update it's refs, I'm not sure aboutpushfrom memory).What can we do here? I think the simplest answer is to push these status indicator updates through our existing infrastructure - these use repository state to control whether or not an operation should be performed.
The worst case scenarios I can think of about this change:
Release notes
Notes: Prevent concurrent fetches corrupting Git index by adding checking to repository indicator updates