Repository navigation
fix: memory leak in task providers - #338231
Dmitriy Vasyura (dmitrivMS) merged 8 commits into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused implementation correctly resolves the leak and is covered by relevant regression tests.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes task-provider failure propagation so RPC requests and discovery callbacks can settle instead of leaking.
Changes:
- Propagates provider and custom task-ID failures.
- Preserves waiting for successful custom task-ID creation.
- Adds regression tests for failures, waiting, and empty results.
| File | Description |
|---|---|
src/vs/workbench/api/common/extHostTask.ts |
Uses async error propagation while awaiting custom task IDs. |
src/vs/workbench/api/test/browser/extHostTask.test.ts |
Covers synchronous/asynchronous failures and successful completion. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Dmitriy Vasyura (dmitrivMS)
left a comment
There was a problem hiding this comment.
See comments
|
Copilot resolve the merge conflicts in this pull request |
|
Copilot resolve the merge conflicts in this pull request |
|
Fixed merged conflicts. The other PR #339387 is also still open, but seems more like an edge case fix and doesn't necessarily need to come before this PR. |
|
Thanks for resolving the conflicts! Per Dmitriy's review, #339387 needs to land first, since without it a late provider failure can drop a healthy provider's tasks. Dmitriy Vasyura (@dmitrivMS), could you take the review on #339387? Then we can merge this one after it. |
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
|
Simon Siefke (@SimonSiefke) Thank you! |

Details
When a task provider fails, its extension-host request never resolves or rejects. The workbench stops waiting after five seconds, but the RPC reply and task-discovery callbacks are not removed. Failed custom task-ID creation has the same problem.
Change
Propagate provider and task-ID failures to the caller while still waiting for custom task IDs before returning successful results.
Before
Fetching tasks from a failing provider 37 times leaves 37 pending RPC replies, 37 lazy promises, and their task-discovery callbacks:
After
No more pending RPC reply or task-discovery callback growth is detected in the same 37-cycle test.
Test Video
The sample provider deliberately fails; each completed refresh dismisses the expected task-error notification.
test.mp4
AI disclosure: Model: GPT 6 Astra. Worktime: 35 min