Skip to content

Fix watching problem collector replay growth - #329733

Open
Dmitriy Vasyura (dmitrivMS) wants to merge 2 commits into
mainfrom
dev/dmitriv/fix-problem-collector-replay-growth-pr
Open

Fix watching problem collector replay growth#329733
Dmitriy Vasyura (dmitrivMS) wants to merge 2 commits into
mainfrom
dev/dmitriv/fix-problem-collector-replay-growth-pr

Conversation

@dmitrivMS

Copy link
Copy Markdown
Contributor

Summary

Fix unbounded retained-output growth in the watching task problem collector when diagnostics are replayed after a text model closes.

The renderer log repeatedly reported:

Invalid array length: RangeError: Invalid array length
    at Array.push (<anonymous>)
    at ...processLineInternal (...workbench.desktop.main.js:4590:8117)

The model-removal recovery path copied the retained task output and passed each line back through processLineInternal. That method appended every replayed line to the retained buffer again, so each replay doubled the buffer and the amount of subsequent work until Array.push reached the maximum array length.

This change processes replayed lines without recording them again. Normal task output, including watching begin and end lines, continues to be retained as before.

Testing

  • Added a regression test that fires two model-removal replays and verifies problem-pattern evaluations remain linear ([1, 2, 3]) instead of doubling ([1, 2, 4]).
  • npm run transpile-client
  • scripts\test.bat --runGlob "**/workbench/contrib/tasks/test/common/*.test.js" — 86 passing, 5 pending
  • npm run eslint -- src/vs/workbench/contrib/tasks/common/problemCollectors.ts src/vs/workbench/contrib/tasks/test/common/problemCollectors.test.ts
  • git diff --check

Fixes #295523

Prevent model-removal diagnostic replays from appending retained task output back into the same buffer.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings August 8, 2026 01:33
@dmitrivMS Dmitriy Vasyura (dmitrivMS) added tasks Task system issues freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues labels Aug 8, 2026
@dmitrivMS Dmitriy Vasyura (dmitrivMS) added tasks Task system issues freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues labels Aug 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Prevents watching problem collector replays from exponentially growing retained task output.

Changes:

  • Suppresses line retention during diagnostic replay.
  • Adds regression coverage verifying linear replay processing.
Show a summary per file
File Description
problemCollectors.ts Avoids re-recording replayed lines.
problemCollectors.test.ts Tests repeated model-removal replays.

Review details

Tip

Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues tasks Task system issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unresponsive window with problem matcher errors

2 participants