Commit 3680622
authored
Defend against missing extension paths (#13649)
Prior to this change, Positron could hang during startup with the UI
stuck in "Preparing", the extension host process alive but no extensions
activating, and most of the workbench frozen. The trigger was a stale
extension directory on disk, typically a bootstrap extension whose old
versioned folder (e.g. `posit.air-vscode-0.24.0-darwin-arm64`) had been
removed but was still referenced by the in-memory extension registry
after a version update.
The root cause was in the extension host's `$startExtensionHost`: it
built a path index by calling `realpath` on every registered extension's
location inside a `Promise.all`. A single missing directory threw
`ENOENT`, rejected the whole `Promise.all`, and prevented
`_startExtensionHost()` from ever running ... which meant the
`_readyToRunExtensions` barrier never opened, so every subsequent
`$activate` RPC waited forever. On the renderer side, the Positron-added
`Promise.all(allExtensionHostStartups).then(...)` had no `.catch`, so
the failure didn't even surface as a visible error.
We now defend against this in three ways:
1. `_createExtensionPathIndex` now skips and logs individual extensions
whose paths can't be resolved instead of failing the whole index build.
2. `$startExtensionHost` wraps its registry-prep preamble in try/catch
so `_startExtensionHost()` is always called and the host always becomes
ready, even if the path index build hits an unexpected error.
3. The renderer-side `Promise.all` on extension-host startups is now
`Promise.allSettled`, with each rejection logged and the
`_allExtensionHostsStarted` barrier always opened so failures are
observable instead of silent.
Fixes #12864.
### Release Notes
<!--
Optionally, replace `N/A` with text to be included in the next release
notes.
The `N/A` bullets are ignored. If you refer to one or more Positron
issues,
these issues are used to collect information about the feature or
bugfix, such
as the relevant language pack as determined by Github labels of type
`lang: `.
The note will automatically be tagged with the language.
These notes are typically filled by the Positron team. If you are an
external
contributor, you may ignore this section.
-->
#### New Features
- N/A
#### Bug Fixes
- Address occasional hang in "Preparing" when starting Positron after
updating to a new version (#12864)
### Validation Steps
Manually deleting an installed extension's directory while leaving its
entry in the registry; confirm Positron now starts normally with a
warning in the log rather than hanging in "Preparing".1 parent 39c9c83 commit 3680622
2 files changed
Lines changed: 42 additions & 13 deletions
File tree
- src/vs/workbench
- api/common
- services/extensions/common
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
370 | 375 | | |
371 | | - | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
372 | 380 | | |
373 | 381 | | |
| 382 | + | |
| 383 | + | |
374 | 384 | | |
375 | 385 | | |
| 386 | + | |
376 | 387 | | |
377 | 388 | | |
378 | 389 | | |
| |||
1013 | 1024 | | |
1014 | 1025 | | |
1015 | 1026 | | |
1016 | | - | |
1017 | | - | |
1018 | | - | |
1019 | | - | |
1020 | | - | |
1021 | | - | |
1022 | | - | |
1023 | | - | |
1024 | | - | |
1025 | | - | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
1026 | 1047 | | |
1027 | 1048 | | |
1028 | 1049 | | |
| 1050 | + | |
1029 | 1051 | | |
1030 | 1052 | | |
1031 | 1053 | | |
| |||
Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1002 | 1002 | | |
1003 | 1003 | | |
1004 | 1004 | | |
1005 | | - | |
1006 | | - | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
1007 | 1014 | | |
1008 | 1015 | | |
1009 | 1016 | | |
| |||
0 commit comments