Batch native debug Output writes - #14771
Sean McManus (sean-mcmanus) wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The implementation is focused and thoroughly covers ordering, flushing, reentrancy, localization, and failure paths.
Pull request overview
Batches native diagnostics to reduce Output-channel append pressure while preserving output semantics and shutdown behavior.
Changes:
- Adds a threshold- and timer-based
BatchedWriter. - Integrates batching and reliable shutdown flushing.
- Adds comprehensive batching, ordering, localization, and disposal tests.
File summaries
| File | Description |
|---|---|
Extension/src/Utility/Async/batchedWriter.ts |
Implements bounded batching. |
Extension/src/logger.ts |
Batches native diagnostic output. |
Extension/src/main.ts |
Ensures channels are disposed on shutdown failures. |
Extension/test/unit/batchedWriter.test.ts |
Tests batching edge cases. |
Extension/test/unit/logger.test.ts |
Tests logger integration and shutdown. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
It looks like we're working around an issue in VS Code. OutputChannel.append() is fire-and-forget: no backpressure, completion signal, queue limits, or documented throughput constraints. If valid high-volume calls can build an unbounded internal queue and OOM, VS Code should coalesce/bound that work or expose a streaming/backpressure API. Rather than working around this problem ourselves, perhaps we could instead propose a fix for VS Code itself? |
|
✨Copilot: Colen Garoutte-Carson (@Colengms) Agreed that the underlying Output scalability issue belongs in VS Code. This PR is only a client-side mitigation, not an alternative to an upstream fix: it reduces append/update frequency while retaining the complete diagnostic stream, but it neither adds backpressure nor bounds the final Output model. The reported append-count reduction is from an injected writer, not a renderer OOM test. Whether to keep this as an interim mitigation or defer it in favor of an upstream fix is a maintainer decision; no upstream fix is included in this PR. |
I have a VS Code PR -- it's been un-reviewed for 6+ weeks, so I'm reluctant to submit a PR for it, but I could file an issue and see if anyone can agree to review it. |
Summary
This PR is an attempt to work around VS Code running out of memory (OOM) when
C_Cpp.loggingLevelis set to7and C/C++ generates a large volume of diagnostic output. It batches native debug Output writes to reduce per-append update pressure while preserving all localized text, line feeds, message order, logging levels, and Output-panel behavior.Details
Validation
Scope
Batching reduces Output append frequency; it does not reduce native notification count or bound VS Code's total retained Output text. The synthetic measurement does not establish that every renderer out-of-memory scenario is eliminated.