Repository navigation
fix: memory leak in test results terminal - #347183
Connor Peet (connor4312) merged 3 commits into
Conversation
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Anthony Kim (@anthonykim1)Matched files:
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the terminal resource-cleanup and marker-filtering changes.
No open issues 🎉
What changed in this PR
This PR addresses memory leaks in the Test Results output terminal by tightening resource disposal and avoiding unused per-message markers.
Changes:
- Dispose terminals that finish creation after the renderer closes, and manage process information with the renderer.
- Filter hidden markers to retain only those needed for the selected message, and simplify pending-write tracking.
- Add regression tests for marker filtering, scope changes, and disposal during terminal creation.
| File | Description |
|---|---|
src/vs/workbench/contrib/testing/test/browser/testResultsOutput.test.ts |
Adds marker-filtering and terminal-disposal regression tests. |
src/vs/workbench/contrib/testing/browser/testResultsView/testResultsOutput.ts |
Fixes resource cleanup, filters unused markers, and simplifies write tracking. |
src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts |
Exposes disposable OSC sequence handler registration. |
src/vs/workbench/contrib/terminal/browser/terminal.ts |
Adds OSC handler registration to the detached terminal interface. |
Review effort: Balanced
P3: hidden-marker filtering introduces false shell-integration timeout diagnosticsAt head Product repro steps to try (source-derived; not executed end-to-end in Code OSS):
The introduced path reports Executed component reproduction: use the compiled production '\x1b]633;SetMark;Id=s0;Hidden\x07synthetic\r\n\x1b]633;SetMark;Id=e0;Hidden\x07'Wait 10.3 seconds:
This confirms the introduced diagnostics behavior at component level; it is not a Code OSS reproduction or a test of the leak fix. Impact is logging/telemetry only, once per affected terminal, with existing telemetry controls unchanged. Pre-existing timeouts for unmarked/no-output terminals are not this finding. |
Dmitriy Vasyura (dmitrivMS)
left a comment
There was a problem hiding this comment.
Please consider review comment
|
[ai-response] Reproduced the false timeout described in the feedback. The issue should now be fixed in a2214ec. Test Results output viewers now opt out of shell-integration activation timeout reporting. The existing reporting option is exposed through detached-terminal creation and forwarded to xterm. Shell-integration marker parsing remains enabled, preserving hidden-marker filtering and selected-message range selection. Added regression tests for whole-run and per-test output that advance past the 10-second deadline and check that neither the timeout telemetry event nor its warning is emitted. All 86 targeted Electron tests, targeted ESLint, and the client typecheck passed. In a real Code OSS window, marked test output remained open for over 50 seconds with correct text, zero hidden markers and no false timeout warning. |
|
Fixed some kind of shell integration timeout issue. |

This PR is related to #346656.
Details
Closing Test Results output while its terminal is being created can leave the new terminal undisposed. Whole-run output also creates hidden markers for every message, although only a selected message needs them.
Change
Dispose terminals that finish creation after the output renderer closes and dispose their process information with the renderer. Skip unused hidden markers and use a counter to track pending writes.
Before
When closing Test Results output while terminal creation is pending for 37 runs, detached terminals and their marker callbacks keep growing:
After
No more leak detected.
Test Video
test.webm
AI disclosure: Model: GPT 6.1 Sol. Worktime: 21 min