vscode icon indicating copy to clipboard operation
vscode copied to clipboard

[error] Canceled: Canceled

Open iegik opened this issue 1 year ago • 13 comments

Type: Bug

2024-04-25 14:01:25.907 [info] Extension host terminating: renderer closed the MessagePort 2024-04-25 14:01:25.915 [error] Canceled: Canceled at new O (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:142:46998) at u.U (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:149:5539) at F..T.charCodeAt.F. (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:149:2993) at d.g (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:152:186335) at d.executeCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:152:185773) at E.registerCommand.description (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:152:185097) at d.h (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:152:186874) at d.g (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:152:185866) at d.executeCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:152:185773) at Object.executeCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:162:22785) at o.O [as value] (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/main.js:2:945802) at s.y (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:82:659) at s.z (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:82:729) at s.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:82:945) at Object.m [as dispose] (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/main.js:2:964886) at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/main.js:2:970920 at Array.forEach () at f.dispose (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/main.js:2:970906) at a. (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:150:3830) at a.dispose (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:150:3927) at a. (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/main.js:2:948059) at a.dispose (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:150:3927) at o (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:30:714) at m.eb (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:158:9967) at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:158:7816 at Array.map () at m.$ (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:158:7803) at m.terminate (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:158:8077) at o.terminate (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:162:1513) at t (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:175:9917) at MessagePortMain. (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:175:6342) at MessagePortMain.emit (node:events:517:28) at MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:2:2285) setContext undefined

VS Code version: Code 1.88.1 (Universal) (e170252f762678dec6ca2cc69aba1570769a5d39, 2024-04-10T17:42:52.765Z) OS version: Darwin arm64 23.4.0 Modes:

System Info
Item Value
CPUs Apple M1 Pro (8 x 24)
GPU Status 2d_canvas: unavailable_software
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
opengl: disabled_off
rasterization: disabled_software
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: disabled_software
video_encode: disabled_software
webgl: unavailable_software
webgl2: unavailable_software
webgpu: unavailable_software
Load (avg) 2, 2, 3
Memory (System) 16.00GB (2.29GB free)
Process Argv
Screen Reader no
VM 0%
Extensions: none

iegik avatar Apr 25 '24 11:04 iegik

Can you give some more details? Was there a problem or is this just an error message that showed up?

roblourens avatar Apr 25 '24 17:04 roblourens

It is just annoying error, that I think due to blind spot in the code on VScode side. That why I have to report it. Will be nice to get some human explanation to this error. It appears on "Reload window" with and without any extension within "Extension Host" OUTPUT tab.

iegik avatar Apr 30 '24 13:04 iegik

Screenshot 2024-04-30 at 16 30 30

iegik avatar Apr 30 '24 13:04 iegik

@iegik, do you have a set of steps that I could follow to reproduce this issue? Thank you!

lszomoru avatar May 27 '24 12:05 lszomoru

  1. CMD + Shift + P "Reload With Extensions Disabled"
  2. Open Extension Host OUTPUT to see the error

iegik avatar May 27 '24 13:05 iegik

Hi, are there any news on this bug?

ermanno avatar Nov 04 '24 15:11 ermanno

I have a 100% repeatable condition on this. After disabling All extensions including build-in:

Enable Git Base (vscode.git-base). No problem. Reload Window. No issues displayed in Extension Host window. Enable Git SCM (vscode.git). With no other activity: Reload Window to get "Canceled : Canceled" message and stack trace.

Note reference in the OP's stacktrace to "git/dist" during dispose. It's the same here.

Please tag this ticket as [git] and [scm].

Stack trace
2025-02-17 08:03:10.380 [info] ExtensionService#_doActivateExtension vscode.git, startup: false, activationEvent: '*'
2025-02-17 08:03:15.905 [info] Extension host terminating: renderer closed the MessagePort
2025-02-17 08:03:15.911 [error] Canceled: Canceled
	at new XR (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:110406)
	at Uy.U (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:115016)
	at s.<computed>.n.charCodeAt.s.<computed> (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:112510)
	at mw.g (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:112:32221)
	at mw.executeCommand (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:112:31725)
	at r.registerCommand.description (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:112:31055)
	at mw.h (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:112:32741)
	at mw.g (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:112:31818)
	at mw.executeCommand (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:112:31725)
	at Object.executeCommand (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:172:37254)
	at Ah.L [as value] (c:\Program Files\Microsoft VS Code\resources\app\extensions\git\dist\main.js:2:997602)
	at D.B (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:27:2373)
	at D.C (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:27:2443)
	at D.fire (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:27:2660)
	at Object.p [as dispose] (c:\Program Files\Microsoft VS Code\resources\app\extensions\git\dist\main.js:2:1020242)
	at c:\Program Files\Microsoft VS Code\resources\app\extensions\git\dist\main.js:2:1026621
	at Array.forEach (<anonymous>)
	at b.dispose (c:\Program Files\Microsoft VS Code\resources\app\extensions\git\dist\main.js:2:1026607)
	at cv.<anonymous> (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:106:20084)
	at cv.dispose (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:106:20180)
	at cv.<anonymous> (c:\Program Files\Microsoft VS Code\resources\app\extensions\git\dist\main.js:2:1000086)
	at cv.dispose (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:106:20180)
	at ui (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:25:699)
	at file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:116:14992
	at file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:25:1009
	at Object.dispose (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:8:705)
	at PW.eb (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:116:11919)
	at file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:116:9874
	at Array.map (<anonymous>)
	at PW.$ (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:116:9862)
	at PW.terminate (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:116:10105)
	at wC.terminate (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:117:1434)
	at ts (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:190:15080)
	at MessagePortMain.<anonymous> (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:190:11628)
	at MessagePortMain.emit (node:events:518:28)
	at MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:2:2949) setContext undefined
2025-02-17 08:03:15.912 [info] Extension host with pid 17832 exiting with code 0

Version: 1.97.1 (system setup) Commit: e249dada235c2083c83813bd65b7f4707fb97b76 Date: 2025-02-10T13:13:58.153Z Electron: 32.2.7 ElectronBuildId: 10660205 Chromium: 128.0.6613.186 Node.js: 20.18.1 V8: 12.8.374.38-electron.0 OS: Windows_NT x64 10.0.19045

TonyGravagno avatar Feb 17 '25 16:02 TonyGravagno

To be clear however, this isn't unique to git or scm. The dispose error can occur with other extensions.
For example, disposal errors happen for:

Gruntfuggly.todo-tree

2025-02-17 08:41:29.001 [error] An error occurred when disposing the subscriptions for extension 'Gruntfuggly.todo-tree':
2025-02-17 08:41:29.002 [error] AggregateError: Encountered errors while disposing of store
	at ui (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:25:775)

wallabyjs.console-ninja-1.0.390

	at mw.executeCommand (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:112:31725)
	at Object.executeCommand (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:172:37254)
	at Ju._stopHost (c:\Users\tonyg\.vscode\extensions\wallabyjs.console-ninja-1.0.390\out\extension\index.js:1:964527)
	at Ju.dispose (c:\Users\tonyg\.vscode\extensions\wallabyjs.console-ninja-1.0.390\out\extension\index.js:1:988835)
	at ui (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:25:699)
	at file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:116:14992
	at file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:25:1009
	at Object.dispose (file:///c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:8:705)

The issue seems to not be with Extension Host, which is just reporting the problem. It's the disposal of extension resources. This situation is as old as code - the extensions are probably losing object references and can't be disposed. It's a coding pattern in the extensions, probably not in VSCode core which is just reporting the problem.

This remains a VSCode issue because of the Git/SCM core integration. But if a pattern is recognized during the fix, document it here so that others might be able to avoid it.

Since the installable extensions might be simpler and more easily able to find and fix their resource reference issues, I'm pointing them here where they might be able to contribute or obtain a solution for a better coding pattern.

TonyGravagno avatar Feb 17 '25 16:02 TonyGravagno

I'm from the team that created wallabyjs.console-ninja. In our case, our code that is failing is:

vscode.commands.executeCommand('setContext', 'console-ninja.started', false);

We use this to control command availability in the command palette.

smcenlly avatar Feb 17 '25 21:02 smcenlly

The same problem affecting the built-in git integration, also affects many extensions. In disposal, many extensions update setContext (similar to the built-in git integration) and this causes the error (e.g. see bradlc.vscode-tailwindcss and eamodio.gitlens).

smcenlly avatar Feb 17 '25 21:02 smcenlly

@lszomoru this is the same issue reported in #232446. (linking these tickets for posterity) Sorry I didn't respond to your inquiry within the few number of days allowed before the bot auto-closed it. 🤷‍♂ 😁

TonyGravagno avatar Feb 21 '25 02:02 TonyGravagno

@TonyGravagno, @smcenlly, thank you both for the additional information.

lszomoru avatar Feb 21 '25 10:02 lszomoru

Adding @jrieken since as you have called out this happens for all extensions that call the setContext command when the extension is being disposed. I am able to easily reproduce this with the vscode.git extension but I think that this error condition should be fixed in the extension host code.

lszomoru avatar Mar 07 '25 14:03 lszomoru

@bpasero, can we close this given https://github.com/microsoft/vscode/commit/51a35659410cda847db2e56807e8ca2eb25e5e37

lszomoru avatar Apr 02 '25 15:04 lszomoru

Yeah, specifically when executing a command, cancellation errros are now ignored.

bpasero avatar Apr 02 '25 15:04 bpasero