Coalesce concurrent download requests for the same object#1929
Merged
tyrielv merged 1 commit intomicrosoft:masterfrom Apr 1, 2026
Merged
Coalesce concurrent download requests for the same object#1929tyrielv merged 1 commit intomicrosoft:masterfrom
tyrielv merged 1 commit intomicrosoft:masterfrom
Conversation
6947db0 to
96a4481
Compare
96a4481 to
6d657ff
Compare
Adds a ConcurrentDictionary<string, Lazy<DownloadAndSaveObjectResult>> to GVFSGitObjects so only one download runs per objectId at a time. Concurrent callers share the result via the Lazy<T> pattern. The entry is removed after completion using value-aware removal (ICollection<KVP>.Remove) to prevent an ABA race where a straggling thread's finally could remove a newer Lazy created by a later wave of requests. Assisted-by: Claude Opus 4.6 Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
6d657ff to
579f483
Compare
KeithIsSleeping
approved these changes
Mar 31, 2026
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.
Problem
Under memory pressure, multiple git.exe processes request the same loose object via named pipes simultaneously. Each request triggers an independent HTTP download — the incident log showed 48,176 events with zero available connections, caused by redundant downloads of the same SHAs.
Change
Adds a
ConcurrentDictionary<string, Lazy<DownloadAndSaveObjectResult>>toGVFSGitObjectsso only one download runs per objectId at a time. Concurrent callers share the result. Entry is removed after completion so subsequent requests get fresh attempts.Key review areas
GetOrAddandTryRemoveinfinally)Testing
3 new unit tests: concurrent coalescing, independent SHAs not coalesced, failed download allows retry.