Repository navigation
fix: memory leak in extHostTimeline - #334098
Dmitriy Vasyura (dmitrivMS) merged 8 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
An in-flight request can repopulate the cache after disposal; generation/disposal handling and race coverage are needed.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Fixes timeline provider cache cleanup after disposal.
Changes:
- Deletes provider-level cached timeline entries on disposal.
- Adds regression coverage for cache cleanup and re-registration.
File summaries
| File | Description |
|---|---|
src/vs/workbench/api/test/browser/extHostTimeline.test.ts |
Tests cache cleanup after disposal. |
src/vs/workbench/api/common/extHostTimeline.ts |
Corrects provider cache deletion. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
P2 / Medium: suppressing a disposed provider's late result can leave a healthy provider's pagination stuckStatic-review finding against The new disposed-result guard correctly prevents stale items and commands from being cached. However, its new
Proposed reproduction Use a development extension with the
Expected: A's stale result is discarded, but B's pagination becomes available again. The pane's handling of genuinely empty/error responses is pre-existing. What changes here is that a successful late response after disposal now takes that path. At the base/initial commit, the same defined late response is incorrectly accepted but also reaches a tree refresh, releasing B's pagination. Please keep the disposal guard and coordinate removed-provider pending-request cleanup with the pane's rendered loading state. Any cancellation/removal should preserve request identity so an old completion cannot remove a replacement request. A pane-level regression test with deferred A and surviving pageable B would cover this interaction; the new extension-host tests do not exercise it. |
Dmitriy Vasyura (dmitrivMS)
left a comment
There was a problem hiding this comment.
Please see inline comments
Remove disposed providers' pending requests before refreshing the pane so surviving providers can continue paging. Ignore completions that no longer own the pending request to protect replacement providers from stale results.
|
Added 0ff1bd3 to try to properly dispose pending requests when timeline view gets disposed. |
|
Simon Siefke (@SimonSiefke) Thank you! |
|
Compile errors: |
Dmitriy Vasyura (dmitrivMS)
left a comment
There was a problem hiding this comment.
Compile errors
Pull request was converted to draft
The bracket-notation lint rule also rejects accesses to TypeScript private members. Expose the required member types through a test-only interface so the regression tests can use dot notation without changing the production API.
Register timeline providers with the suite disposable store so failed assertions still clean up. Verify the cached item resolves before disposal, and require the argument processor and timeline result instead of allowing missing setup to pass through optional access.
|
Fixed some issues! |
Details
When a timeline provider caches results, extHostTimeline stores each item under the provider ID and resource URI. But disposing the provider looks for that ID inside the URI maps, so the provider's cache entry is not removed.
Change
Delete the provider's top-level cache entry when its wrapped provider is disposed.
Before
When registering, requesting, and disposing 37 timeline providers, timeline items and their command callbacks grow once per cycle:
After
No more timeline provider cache leak is detected.
Test Video
test-video.webm