Fix infinite loop in packfile MRU after prefetch packs are added#822
Merged
dscho merged 2 commits intomicrosoft:vfs-2.52.0from Nov 18, 2025
Merged
Fix infinite loop in packfile MRU after prefetch packs are added#822dscho merged 2 commits intomicrosoft:vfs-2.52.0from
dscho merged 2 commits intomicrosoft:vfs-2.52.0from
Conversation
This fixup updates b46ad0a (gvfs-helper: create tool to fetch objects using the GVFS Protocol, 2019-08-13) in reaction to f6f236d (packfile: refactor `install_packed_git()` to work on packfile store, 2025-09-23) which is included in Git 2.52.0. The refactored packfile store includes an automatic inclusion of new packifles into the MRU list. This introduces a bug in microsoft/git's use of the GVFS protocol in the following scenario in 'git fetch': 1. If the prefetch downloads at least one prefetch packfile, then it is added to the MRU list twice, creating an infinite loop. 2. If the refs that are updated include commits that are not present in the packfile list, then the MRU lookup will iterate through without interruption, hitting the infinite loop. The fix is to modify this patch to no longer include a custom "add to MRU" method now that the default implementation does this for us. Signed-off-by: Derrick Stolee <stolee@gmail.com>
This makes the commit trivial and will be dropped in a future update. Signed-off-by: Derrick Stolee <stolee@gmail.com>
80a3178 to
13b8048
Compare
dscho
approved these changes
Nov 18, 2025
Member
dscho
left a comment
There was a problem hiding this comment.
Thank you so much @derrickstolee!
1 task
dscho
added a commit
that referenced
this pull request
Nov 21, 2025
This is a fix for a performance regression introduced by #822. That change updated the packfile installation process to call a different packfile installation method after some upstream changes to the packfile data structures. However, while I thought I read the new packfile methods as including a modification of the MRU cache, it apparently does not fully install the packfile in the list. This manifests in something like `git checkout` where the missing blobs are queued for download, downloaded in blob packfiles, and then the checkout process continues. During the process of writing the data to the worktree, the "updating files" progress indicator slows to a crawl because it was "missing" the blobs and then downloaded them on-demand. This fixes the issue by being less fancy about packfiles and using `packfile_store_reprepare()` to just reset the full packfile list. This is more future-proof and isn't very expensive compared to the packfile download. I augmented a test to include tracing that shows a necessary blob is queued for packfile download and is not later downloaded via an immediate request. Without the code change, that test would fail. * [X] This change only applies to interactions with Azure DevOps and the GVFS Protocol.
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 fixup updates b46ad0a (gvfs-helper: create tool to fetch objects using the GVFS Protocol, 2019-08-13) in reaction to f6f236d (packfile: refactor
install_packed_git()to work on packfile store, 2025-09-23) which is included in Git 2.52.0.This PR is organized to fixup the commit mentioned above and to drop 4e743e6 (packfile: add install_packed_git_and_mru(), 2019-09-25) now that the packfile method is no longer used.
The refactored packfile store includes an automatic inclusion of new packifles into the MRU list. This introduces a bug in microsoft/git's use of the GVFS protocol in the following scenario in 'git fetch':
If the prefetch downloads at least one prefetch packfile, then it is added to the MRU list twice, creating an infinite loop.
If the refs that are updated include commits that are not present in the packfile list, then the MRU lookup will iterate through without interruption, hitting the infinite loop.
The fix is to modify this patch to no longer include a custom "add to MRU" method now that the default implementation does this for us.
GVFS Protocol.