fix: wire ext host restart through utility process api#302633
fix: wire ext host restart through utility process api#302633deepak1556 wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes the extension host restart path so that a blocked/unresponsive extension host is properly terminated via the utility process API, addressing the “rogue Code Helper (Plugin)” process reported in #296681.
Changes:
- Add a main-process
waitForExitcapability to the extension host starter and plumb a shared grace-time constant. - Implement a local extension host
disconnect()that requests graceful termination and then waits (with grace time) for the process to exit. - Extend smoke coverage to validate that restarting the extension host replaces the PID and terminates the old process.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/smoke/src/areas/extensions/extension-host-restart.test.ts | Adds a smoke test that restarts the extension host and verifies old PID termination + new PID observed. |
| test/smoke/extensions/vscode-smoketest-ext-host/extension.js | Writes an “activation PID” marker on activation to support restart validation in smoke tests. |
| src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts | Adds disconnect() for local ext host that sends terminate and waits for utility-process exit; tweaks dispose behavior. |
| src/vs/platform/extensions/electron-main/extensionHostStarter.ts | Implements waitForExit() and uses shared grace-time constant for window lifecycle binding. |
| src/vs/platform/extensions/common/extensionHostStarter.ts | Introduces extensionHostGraceTimeMs and adds waitForExit to the starter interface. |
You can also share your feedback on Copilot code review. Take the survey.
src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts
Show resolved
Hide resolved
7a952c1 to
3435c28
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes the “Restart Extension Host” shutdown path so a blocked/rogue extension host utility process is reliably terminated (follow-up to window-lifecycle binding work) and adds a smoke test to prevent regressions (issue #296681).
Changes:
- Add a
waitForExitcapability to theIExtensionHostStarterutility-process API and expose it to the renderer-side extension host wrapper. - Ensure local extension host
disconnect()requests graceful termination and then waits (with a grace period) before force-killing. - Add smoke test coverage validating that restarting the extension host kills a blocked old PID and spawns a new PID.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/smoke/src/areas/extensions/extension-host-restart.test.ts | Adds a smoke test for “Restart Extension Host” ensuring the old blocked PID is terminated and a new PID appears. |
| test/smoke/extensions/vscode-smoketest-ext-host/extension.js | Writes the ext host PID on activation so the smoke test can observe the new PID after restart. |
| src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts | Implements disconnect() to send terminate + wait/force-kill via the utility process starter API. |
| src/vs/platform/extensions/electron-main/extensionHostStarter.ts | Wires windowLifecycleGraceTime to a shared constant and adds waitForExit implementation over WindowUtilityProcess. |
| src/vs/platform/extensions/common/extensionHostStarter.ts | Introduces extensionHostGraceTimeMs constant and adds waitForExit to the starter interface. |
You can also share your feedback on Copilot code review. Take the survey.
| } | ||
|
|
||
| if (this._extensionHostProcess) { | ||
| await this._extensionHostProcess.waitForExit(extensionHostGraceTimeMs); |
Fixes #296681
Followup to #293144 covering extension host restart path