Repository navigation
fix: memory leak in SCM artifact commands - #338251
Merged
Ladislau Szomoru (lszomoru) merged 2 commits intoSep 28, 2026
Merged
Ladislau Szomoru (lszomoru) merged 2 commits into
Ladislau Szomoru (lszomoru) merged 2 commits into
Conversation
# Conflicts: # src/vs/workbench/api/test/common/extHostSCM.test.ts
Copilot started reviewing on behalf of
Simon Siefke (SimonSiefke)
September 27, 2026 19:30
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The lifecycle guard addresses the leak and the focused tests cover the relevant failure paths.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes SCM artifact command-cache leaks caused by late, canceled, rejected, or obsolete provider requests.
Changes:
- Validate provider lifetime and cancellation after awaiting artifacts.
- Delay command-store allocation until results remain valid.
- Add lifecycle and cache-cleanup regression tests.
| File | Description |
|---|---|
src/vs/workbench/api/common/extHostSCM.ts |
Prevents stale requests from caching artifact commands. |
src/vs/workbench/api/test/common/extHostSCM.test.ts |
Covers disposal, replacement, cancellation, rejection, and cleanup. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Ladislau Szomoru (lszomoru)
approved these changes
Sep 28, 2026
Member
|
Simon Siefke (@SimonSiefke), thank you! |
Nick Trogh (ntrogh)
approved these changes
Sep 28, 2026
Christof Marti (chrmarti)
approved these changes
Sep 28, 2026
Simon Siefke (SimonSiefke)
deleted the
fix/memory-leak-scmArtifact-lateResults
branch
September 29, 2026 11:15
Abdon Morales (abdonmorales)
pushed a commit
to abdonmorales/vscode-utcs
that referenced
this pull request
Oct 1, 2026
fix: discard stale source control artifact command results (cherry picked from commit fee7930)
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.
Details
An artifact request can finish after its source control or artifact provider has been disposed. The late result still converts command arguments and adds a command store to the disposed owner. A rejected request also leaves the store created before the await undisposed.
Change
Check the original provider's lifetime and cancellation after the request finishes. Create the command store only after that check, so rejected and obsolete requests cannot leave command entries behind.
Before
Opening delayed SCM artifacts, disposing the source control, and completing the pending request 37 times adds 37 old command-argument objects.
After
No more artifact-command argument growth is detected in the same 37-cycle test. The matching command-cache entries stay at zero.
Test Video
Seven delayed artifact request and source-control disposal cycles in the Repositories view.
test.mp4
AI disclosure: Model: GPT 6 Astra. Worktime: 22 min