microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.95k stars 29.53k forks source link

Unhandled Rejection on extension host teardown #232446

Open gmccullo opened 1 month ago

gmccullo commented 1 month ago

Type: Bug

I've been working on a new extension called "Interlinks". When exiting the extension host after debugging, the IDE almost always stops on an exception. As far as I can make out the exception is unrelated to the extension. I checked this by creating a barebones "hello world" exception and running it using the Default profile with no extensions installed, and none in the extension host either. I added a process.on('unhandledRejection') handler and was able to capture this stack trace:

Unhandled Rejection at: Promise {[[PromiseState]]: 'rejected', [[PromiseResult]]: Canceled: Canceled
    at new eA (file:///c…/Local/Programs/Microsoft%20VS%20Code/r…, Symbol(async_id_symbol): 647729, Symbol(trigger_async_id_symbol): 0}
Reason: Canceled: Canceled
    at new eA (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:31:109321)
    at Zb.U (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:31:113933)
    at s.<computed>.n.charCodeAt.s.<computed> (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:31:111427)
    at T0.g (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:114:32325)
    at T0.executeCommand (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:114:31826)
    at r.registerCommand.description (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:114:31156)
    at T0.h (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:114:32845)
    at T0.g (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:114:31919)
    at T0.executeCommand (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:114:31826)
    at Object.executeCommand (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:156:37049)
    at gh.O [as value] (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\main.js:2:953034)
    at T.B (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:29:732)
    at T.C (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:29:802)
    at T.fire (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:29:1019)
    at Object.p [as dispose] (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\main.js:2:973612)
    at c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\main.js:2:979734
    at Array.forEach (<anonymous>)
    at f.dispose (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\main.js:2:979720)
    at D1.<anonymous> (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:108:19996)
    at D1.dispose (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:108:20092)
    at D1.<anonymous> (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\main.js:2:955332)
    at D1.dispose (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:108:20092)
    at Si (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:24:701)
    at c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:118:14995
    at c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:24:1011
    at Object.dispose (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:7:2146)
    at hB.eb (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:118:11922)
    at c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:118:9877
    at Array.map (<anonymous>)
    at hB.$ (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:118:9865)
    at hB.terminate (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:118:10108)
    at M3.terminate (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:119:1424)
    at ps (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:174:15058)
    at MessagePortMain.<anonymous> (c:\Users\gary\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:174:11603)
    at MessagePortMain.emit (C:\Users\gary\OneDrive\programming\vscode\interlinks\Interlinks\lib\events.js:519:28)
    at MessagePortMain._internalPort.emit (C:\Users\gary\OneDrive\programming\vscode\interlinks\Interlinks\lib\electron\js2c\utility_init.js:2:2619)
    at Object.callbackTrampoline (node:internal/async_hooks:130:17) {name: 'Canceled', stack: 'Canceled: Canceled
    at new eA (file:///c:/Use…Trampoline (node:internal/async_hooks:130:17)', message: 'Canceled'}

VS Code version: Code 1.94.2 (384ff7382de624fb94dbaf6da11977bba1ecd427, 2024-10-09T16:08:44.566Z) OS version: Windows_NT x64 10.0.22631 Modes:

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 7 3750H with Radeon Vega Mobile Gfx (8 x 2296)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off| |Load (avg)|undefined| |Memory (System)|61.95GB (35.75GB free)| |Process Argv|--folder-uri file:///c%3A/Users/gary/OneDrive/programming/vscode/teardown-demo --crash-reporter-id 2ba0f4e4-3510-454f-9af6-136975db26b9| |Screen Reader|no| |VM|0%|
Extensions (55) Extension|Author (truncated)|Version ---|---|--- TabOut|alb|0.2.2 increment-selection|alb|0.2.0 Bookmarks|ale|13.5.0 html-end-tag-labels|ant|1.0.0 auto-generics-tag|Ben|0.0.1 esbuild-problem-matchers|con|0.0.3 vscode-markdownlint|Dav|0.56.0 vscode-eslint|dba|3.0.10 githistory|don|0.6.20 xml|Dot|2.5.1 overtype|DrM|0.5.0 vsc-material-theme-icons|equ|3.8.8 url-encode|fle|1.1.0 html-preview-vscode|geo|0.2.5 live-sass|gle|6.1.2 todo-tree|Gru|0.0.226 vscode-html-validate|htm|2.9.1 markdown-extended|jeb|1.1.4 docomment|k--|1.0.0 wordcounter|kir|2.4.4 csharpextensions|kre|1.7.3 vscode-autohotkey-plus-plus|mar|6.3.0 rainbow-csv|mec|3.12.0 render-crlf|med|1.8.1 csdevkit|ms-|1.11.14 csharp|ms-|2.50.27 vscode-dotnet-runtime|ms-|2.2.1 vscodeintellicode-csharp|ms-|2.1.11 extension-test-runner|ms-|0.0.12 powershell|ms-|2024.2.2 test-adapter-converter|ms-|0.2.0 material-icon-theme|PKi|5.12.0 word-counter|plu|0.0.1 toggle|reb|0.0.2 vscode-xml|red|0.27.1 vscode-yaml|red|1.15.0 vscode-sort-json|ric|1.20.0 block-travel|sas|0.0.2 some-sass|Som|4.0.2 sonarlint-vscode|Son|4.11.1 code-spell-checker|str|3.0.1 code-spell-checker-british-english|str|1.4.11 code-spell-checker-french|str|0.4.1 code-spell-checker-german|str|2.3.2 code-spell-checker-greek|str|1.2.2 code-spell-checker-italian|str|1.1.1 code-spell-checker-medical-terms|str|3.0.2 code-spell-checker-scientific-terms|str|0.2.2 code-spell-checker-spanish|str|2.3.4 vscode-icons|vsc|12.9.0 whichkey|VSp|0.11.4 quokka-vscode|Wal|1.0.656 copyrawvalue|wer|1.0.0 deletehere|xin|0.0.1 markdown-all-in-one|yzh|3.6.2 (1 theme extensions excluded)
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805:30301674 binariesv615:30325510 vsaa593:30376534 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 a9j8j154:30646983 962ge761:30959799 pythongtdpath:30769146 pythonnoceb:30805159 asynctok:30898717 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 01bff139:31013167 dvdeprecation:31068756 dwnewjupytercf:31046870 2f103344:31071589 impr_priority:31102340 nativerepl1:31139838 refactort:31108082 pythonrstrctxt:31112756 wkspc-onlycs-t:31132770 nativeloc2:31134642 wkspc-ranged-t:31151552 cf971741:31144450 iacca2:31156134 notype1cf:31157160 5fd0e150:31155592 dwcopilot:31164048 icondisabled:31158250 ```
roblourens commented 1 month ago

Git extension doing something unexpected?

TonyGravagno commented 1 day ago

I think I'm seeing the same error. I have disabled all installable extensions. On Window Reload I see the exception stack. Disable the vscode.git (Git SCM built-in extension) and reload. There is one final exception. Reload again, no errors. After a few reloads with no errors, enabled vscode.git builtin extension again (no loading error). Reload ... error.

Error does not occur when there is no folder/workspace open.

Platform

VSCode v1.95.3 ```log Version: 1.95.3 (system setup) Commit: f1a4fb101478ce6ec82fe9627c43efbf9e98c813 Date: 2024-11-13T14:50:04.152Z Electron: 32.2.1 ElectronBuildId: 10427718 Chromium: 128.0.6613.186 Node.js: 20.18.0 V8: 12.8.374.38-electron.0 OS: Windows_NT x64 10.0.19045 ```

Full trace

Extension host terminating ```log 2024-12-02 09:56:19.466 [info] Extension host terminating: renderer closed the MessagePort 2024-12-02 09:56:19.483 [error] Canceled: Canceled at new tT (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:31:108738) at py.U (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:31:113348) at s..n.charCodeAt.s. (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:31:110842) at Y0.g (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:32313) at Y0.executeCommand (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:31817) at r.registerCommand.description (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:31147) at Y0.h (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:32833) at Y0.g (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:31910) at Y0.executeCommand (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:31817) at Object.executeCommand (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:156:37246) at mh.O [as value] (c:\Program Files\Microsoft VS Code\resources\app\extensions\git\dist\main.js:2:961845) at D.B (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:746) at D.C (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:816) at D.fire (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:1033) at Object.p [as dispose] (c:\Program Files\Microsoft VS Code\resources\app\extensions\git\dist\main.js:2:983333) at c:\Program Files\Microsoft VS Code\resources\app\extensions\git\dist\main.js:2:989455 at Array.forEach () at b.dispose (c:\Program Files\Microsoft VS Code\resources\app\extensions\git\dist\main.js:2:989441) at V1. (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:108:19994) at V1.dispose (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:108:20090) at V1. (c:\Program Files\Microsoft VS Code\resources\app\extensions\git\dist\main.js:2:964255) at V1.dispose (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:108:20090) at ci (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:24:699) at file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:118:14992 at file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:24:1009 at Object.dispose (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:7:2146) at z_.eb (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:118:11919) at file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:118:9874 at Array.map () at z_.$ (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:118:9862) at z_.terminate (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:118:10105) at EC.terminate (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:119:1424) at Zi (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:174:15084) at MessagePortMain. (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:174:11632) at MessagePortMain.emit (node:events:519:28) at MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:2:2949) setContext undefined 2024-12-02 09:56:19.484 [error] Canceled: Canceled at new tT (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:31:108738) at py.U (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:31:113348) at s..n.charCodeAt.s. (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:31:110842) at Y0.g (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:32313) at Y0.executeCommand (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:31817) at r.registerCommand.description (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:31147) at Y0.h (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:32833) at Y0.g (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:31910) at Y0.executeCommand (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:31817) at Object.executeCommand (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:156:37246) at set hasGitHubRepositories (c:\Program Files\Microsoft VS Code\resources\app\extensions\github\dist\extension.js:2:328633) at c:\Program Files\Microsoft VS Code\resources\app\extensions\github\dist\extension.js:2:329592 at mh.value (c:\Program Files\Microsoft VS Code\resources\app\extensions\git\dist\main.js:2:1073936) at D.B (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:746) at D.C (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:816) at D.fire (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:1033) at Object.p [as dispose] (c:\Program Files\Microsoft VS Code\resources\app\extensions\git\dist\main.js:2:983333) at c:\Program Files\Microsoft VS Code\resources\app\extensions\git\dist\main.js:2:989455 at Array.forEach () at b.dispose (c:\Program Files\Microsoft VS Code\resources\app\extensions\git\dist\main.js:2:989441) at V1. (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:108:19994) at V1.dispose (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:108:20090) at V1. (c:\Program Files\Microsoft VS Code\resources\app\extensions\git\dist\main.js:2:964255) at V1.dispose (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:108:20090) at ci (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:24:699) at file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:118:14992 at file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:24:1009 at Object.dispose (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:7:2146) at z_.eb (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:118:11919) at file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:118:9874 at Array.map () at z_.$ (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:118:9862) at z_.terminate (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:118:10105) at EC.terminate (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:119:1424) at Zi (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:174:15084) at MessagePortMain. (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:174:11632) at MessagePortMain.emit (node:events:519:28) at MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:2:2949) setContext undefined 2024-12-02 09:56:19.485 [info] Extension host with pid 26404 exiting with code 0 ```