Repository navigation
ipc: Avoid buffering unused native host blur events - #328535
Merged
roblourens merged 2 commits intoAug 2, 2026
Merged
Conversation
Allow selected proxy events to subscribe lazily, and apply that behavior to the main-window blur event that has no IPC consumer. This avoids an unbounded event buffer while preserving the event for future listeners. (Written by Copilot) Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds opt-in lazy event subscriptions to prevent unused IPC events from buffering indefinitely.
Changes:
- Introduces
unbufferedEventsforProxyChannel.fromService. - Makes
onDidBlurMainWindowlazy and non-replaying. - Tests lazy subscription, delivery, and cleanup.
Show a summary per file
| File | Description |
|---|---|
src/vs/base/parts/ipc/common/ipc.ts |
Implements unbuffered proxy events. |
src/vs/base/parts/ipc/test/common/ipc.test.ts |
Tests subscription lifecycle. |
src/vs/code/electron-main/app.ts |
Configures main-window blur as unbuffered. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Balanced
Document why the main-window blur event must not use the proxy event buffer.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <[email protected]>
roblourens
marked this pull request as ready for review
August 2, 2026 00:07
roblourens
enabled auto-merge (squash)
August 2, 2026 00:07
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Robo (@deepak1556)Matched files:
|
Ross Wollman (rwoll)
approved these changes
Aug 2, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
ProxyChannel.fromServiceeagerly subscribes to and buffers service events so startup events can be replayed when an IPC client attaches.onDidBlurMainWindowhas no IPC consumer, so every main-window blur was retained indefinitely and the eager proxy subscription was unnecessary.In dev builds this produces an
[Event.buffer][onDidBlurMainWindow] potential LEAK detectedwarning after buffered events remain unconsumed.History
This is long-standing rather than a recent regression:
42f5594892(2023-11-02) split focus/blur into main-only and main-or-auxiliary events. Renderer consumers moved to the combined event, leaving the main-only blur buffer without an IPC listener.a837f16fbe(2026-02-28) addedEvent.bufferleak diagnostics, making the existing unbounded buffer visible.The main-only focus event remains buffered because Settings Sync consumes it through the shared-process native host channel.
Fix
unbufferedEventsproxy-channel option that subscribes only when an IPC client listensonDidBlurMainWindowlazy/unbuffered while preserving the event API for future consumersCC Benjamin Pasero (@bpasero) for the auxiliary-window event history.
Validation
npm run compile./scripts/test.sh --run src/vs/base/parts/ipc/test/common/ipc.test.ts(23 passing)npm run precommit(Written by Copilot)