Repository navigation
fix: memory leak in notebook serializer disposal - #338212
Merged
Dmitriy Vasyura (dmitrivMS) merged 1 commit intoSep 29, 2026
Merged
Dmitriy Vasyura (dmitrivMS) merged 1 commit into
Dmitriy Vasyura (dmitrivMS) merged 1 commit into
Conversation
Copilot started reviewing on behalf of
Simon Siefke (SimonSiefke)
September 27, 2026 17:25
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused lifecycle fix addresses the leak without disrupting in-flight operations and has appropriate regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes retained notebook serializers in the extension host after registration disposal.
Changes:
- Removes disposed serializers from the extension-host registry before main-thread unregistration.
- Adds lifecycle, isolation, idempotency, and in-flight operation tests.
| File | Description |
|---|---|
src/vs/workbench/api/common/extHostNotebook.ts |
Deletes the serializer registry entry during disposal. |
src/vs/workbench/api/test/browser/extHostNotebookSerializer.test.ts |
Verifies serializer disposal behavior and request handling. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
September 29, 2026 02:16
Collaborator
|
Simon Siefke (@SimonSiefke) Thank you! |
Dmitriy Vasyura (dmitrivMS)
approved these changes
Sep 29, 2026
Anthony Kim (anthonykim1)
approved these changes
Sep 29, 2026
Ladislau Szomoru (lszomoru)
approved these changes
Sep 29, 2026
Simon Siefke (SimonSiefke)
deleted the
fix/memory-leak-notebookSerializer-disposal
branch
September 29, 2026 11:15
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
Disposing a notebook serializer registration unregisters it from the main thread but leaves the provider in the extension host serializer registry. Old serializers remain there after their notebooks close and can still handle requests using disposed registration handles.
Change
Delete the serializer registry entry before unregistering it from the main thread. Preserve other live serializers and allow operations that already started to finish without restoring the registration.
Before
Registering a serializer, opening and closing its notebook, and disposing the registration 37 times adds 37 old serializers. The extension host registry grows from 2 to 39 provider entries.
After
No more serializer growth is detected in the same 37-cycle test. The registry stays empty at both snapshots and the named growth result is empty. Small unrelated array and object differences remain in the full heap comparison.
Test Video
Seven serializer registration, notebook open/close, and registration disposal cycles.
test.mp4
AI disclosure: Model: GPT 6 Astra. Worktime: 32min