microsoft / vscode-test-cli

Command-line runner for VS Code tests
MIT License
20 stars 8 forks source link

Extension host is unresponsive leads to crash #60

Closed andressmithrio closed 1 week ago

andressmithrio commented 1 week ago

I have been using vscode-test for a couple days without any issues, but since this morning any time I run the tests for my extension, the extension code hangs immediately after starting, and causes the extensions to not work, and the tests to crash. Running the tests manually through the UI also yields the same result. I have tried deleting the .vscode-test directory containing the downloaded vscode versions as well as all their data, and loading without any extension aside from the one under test, but it always hangs. I also tried with older versions of VSCode in case an update overnight broke something, but with no luck. I am also unable to find any logs in the .vscode-test directory that would indicate where the problem may be coming from.

Here is the output from the console:

~/git/my-project main +17 !5 ?1 ❯ npm run test-code-gen                                                                                                                                                                 36s 14:09:28

> my-project@1.2.1 test-code-gen
> tsc -p ./ && rm -rf test/workspace/.vscode && vscode-test --label gen-small

✔ Validated version: insiders
✔ Found existing install in /Users/andres.smith/git/my-project/.vscode-test/vscode-darwin-arm64-insiders
[main 2024-10-02T12:18:02.163Z] update#setState disabled
[main 2024-10-02T12:18:02.163Z] update#ctor - updates are disabled by the environment
2024-10-02 14:18:02.384 Code - Insiders Helper (Renderer)[19427:206408] CoreText note: Client requested name ".NewYork-Regular", it will get TimesNewRomanPSMT rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2024-10-02 14:18:02.384 Code - Insiders Helper (Renderer)[19427:206408] CoreText note: Set a breakpoint on CTFontLogSystemFontNameRequest to debug.
Started local extension host with pid 19446.
Loading development extension at /Users/andres.smith/git/my-project

  Extension Test Suite
My Project extension is now active!
Extension host (LocalProcess pid: 19446) is unresponsive.
UNRESPONSIVE extension host: starting to profile NOW
[1002/141824.632963:ERROR:directory_reader_posix.cc(43)] opendir /Users/andres.smith/git/my-project/.vscode-test/user-data/Crashpad/attachments/11d13d2e-f7ec-4156-97ba-d89a7389a338: No such file or directory (2)
[main 2024-10-02T12:18:24.695Z] Extension host with pid 19446 exited with code: 6, signal: unknown.
[main 2024-10-02T12:18:24.696Z] [UtilityProcess id: 1, type: extensionHost, pid: 19446]: crashed with code 6 and reason 'crashed'
[main 2024-10-02T12:18:24.711Z] [UtilityProcessWorker]: terminated unexpectedly with code 1833302960, signal: unknown
Exit code:   6

I have also tried to use my local installations of VSCode and VSCodeInsider through useInstallation in the .vscode-test.mjs file like so:

useInstallation: {
      fromMachine: true,
      fromPath: "/Applications/Visual\ Studio\ Code.app/Contents/MacOS/Electron"
}

Searching for the process it complains is unresponsive, I see it active through ps all the way until vscode-test stops everything, here is what the command looks like:

/Users/andres.smith/git/my-project/.vscode-test/vscode-darwin-arm64-insiders/Visual Studio Code - Insiders.app/Contents/Frameworks/Code - Insiders Helper (Plugin).app/Contents/MacOS/Code - Insiders Helper (Plugin) --type=utility --utility-sub-type=node.mojom.NodeService --lang=en-GB --service-sandbox-type=none --no-sandbox --dns-result-order=ipv4first --expose-gc --inspect-port=0 --user-data-dir=/Users/andres.smith/git/my-project/.vscode-test/user-data --standard-schemes=vscode-webview,vscode-file --secure-schemes=vscode-webview,vscode-file --cors-schemes=vscode-webview,vscode-file --fetch-schemes=vscode-webview,vscode-file --service-worker-schemes=vscode-webview --code-cache-schemes=vscode-webview,vscode-file --shared-files --field-trial-handle=1718379636,r,2701257536768249706,8603116979271084705,262144 --enable-features=ScreenCaptureKitPickerScreen,ScreenCaptureKitStreamPickerSonoma,kWebSQLAccess --disable-features=CalculateNativeWinOcclusion,SpareRendererForSitePerProcess --variations-seed-version

I have also tried running the same code on a Linux amd64 machine, with its own version of VSCode and it runs into the same issue.

Any idea what may be causing the extension host to hang instantly? The extension under test works fine when installed in VSCode manually, through the VSIX file.

andressmithrio commented 1 week ago

The issue seems to have been caused by awaiting an execution of a VSCode command using the VSCode API. Once I removed the await, the extension host stopped crashing.