microsoft / vscode

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

Opening settings in restricted network environment takes a long time to load #226597

Open tudortimi opened 3 weeks ago

tudortimi commented 3 weeks ago

Does this issue occur when all extensions are disabled?: Yes

I use VS Code in a restricted network environment, without access to the Internet. Whenever I try to open the settings UI, it takes a very long time to load (in the order of minutes):

image

I tried starting with --verbose. I see what I believe is VS Code recognizing the command:

[1517735:0826/114154.081373:INFO:CONSOLE(660)] "%cTRACE color: #888 KeybindingService#dispatch Ctrl+Shift+P [ Will dispatch command workbench.action.showCommands ]", source: vscode-file://vscode-app/opt/vscode/1.92.2/VSCode-linux-x64/resources/app/out/vs/workbench/workbench.desktop.main.js (660)
[1517735:0826/114154.081484:INFO:CONSOLE(660)] "%cTRACE color: #888 CommandService#executeCommand workbench.action.showCommands", source: vscode-file://vscode-app/opt/vscode/1.92.2/VSCode-linux-x64/resources/app/out/vs/workbench/workbench.desktop.main.js (660)
[1517735:0826/114154.338085:INFO:CONSOLE(660)] "%cTRACE color: #888 KeybindingService#dispatch S [ No matching keybinding ]", source: vscode-file://vscode-app/opt/vscode/1.92.2/VSCode-linux-x64/resources/app/out/vs/workbench/workbench.desktop.main.js (660)
[1517735:0826/114154.537891:INFO:CONSOLE(660)] "%cTRACE color: #888 KeybindingService#dispatch E [ No matching keybinding ]", source: vscode-file://vscode-app/opt/vscode/1.92.2/VSCode-linux-x64/resources/app/out/vs/workbench/workbench.desktop.main.js (660)
[1517735:0826/114154.761740:INFO:CONSOLE(660)] "%cTRACE color: #888 KeybindingService#dispatch T [ No matching keybinding ]", source: vscode-file://vscode-app/opt/vscode/1.92.2/VSCode-linux-x64/resources/app/out/vs/workbench/workbench.desktop.main.js (660)
[1517735:0826/114155.156347:INFO:CONSOLE(660)] "%cTRACE color: #888 CommandService#executeCommand workbench.action.openSettings2", source: vscode-file://vscode-app/opt/vscode/1.92.2/VSCode-linux-x64/resources/app/out/vs/workbench/workbench.desktop.main.js (660)
[1517735:0826/114155.186246:INFO:CONSOLE(660)] "%cTRACE color: #888 onWillActivateByEvent:  onLanguage", source: vscode-file://vscode-app/opt/vscode/1.92.2/VSCode-linux-x64/resources/app/out/vs/workbench/workbench.desktop.main.js (660)
[1517735:0826/114155.233697:INFO:CONSOLE(660)] "%cTRACE color: #888 writeTextAreaState(reason: focusgain)", source: vscode-file://vscode-app/opt/vscode/1.92.2/VSCode-linux-x64/resources/app/out/vs/workbench/workbench.desktop.main.js (660)
[1517735:0826/114155.270636:INFO:CONSOLE(660)] "%c WARN color: #993 SettingsEditor2: Settings not included in settingsLayout.ts: issueReporter.experimental.auxWindow", source: vscode-file://vscode-app/opt/vscode/1.92.2/VSCode-linux-x64/resources/app/out/vs/workbench/workbench.desktop.main.js (660)
[1517735:0826/114155.338902:INFO:CONSOLE(660)] "%cTRACE color: #888 [History stack global-default]: notifyNavigation() (editor: vscode-settings:settingseditor, event: <none>)", source: vscode-file://vscode-app/opt/vscode/1.92.2/VSCode-linux-x64/resources/app/out/vs/workbench/workbench.desktop.main.js (660)
[1517735:0826/114155.339003:INFO:CONSOLE(660)] "%cTRACE color: #888 [History stack global-default]: notifyNavigation() not ignoring (editor: vscode-settings:settingseditor, event: <none>)", source: vscode-file://vscode-app/opt/vscode/1.92.2/VSCode-linux-x64/resources/app/out/vs/workbench/workbench.desktop.main.js (660)
[1517735:0826/114155.339174:INFO:CONSOLE(660)] "%cTRACE color: #888 [History stack global-default]: onNonSelectionAwareEditorNavigation() (editor: vscode-settings:settingseditor, event: <none>)", source: vscode-file://vscode-app/opt/vscode/1.92.2/VSCode-linux-x64/resources/app/out/vs/workbench/workbench.desktop.main.js (660)
[1517735:0826/114155.339252:INFO:CONSOLE(660)] "%cTRACE color: #888 [History stack global-default]: add() (editor: vscode-settings:settingseditor, event: <none>)", source: vscode-file://vscode-app/opt/vscode/1.92.2/VSCode-linux-x64/resources/app/out/vs/workbench/workbench.desktop.main.js (660)

Later on, I see the following when the settings have been populated in the GUI:

[1517735:0826/114203.094084:INFO:CONSOLE(660)] "%cTRACE color: #888 writeTextAreaState(reason: focusgain)", source: vscode-file://vscode-app/opt/vscode/1.92.2/VSCode-linux-x64/resources/app/out/vs/workbench/workbench.desktop.main.js (660)
[1517735:0826/114237.995455:INFO:CONSOLE(660)] "%cDEBUG background: #eee; color: #888 Comments: URIs of continue on comments to add to storage .", source: vscode-file://vscode-app/opt/vscode/1.92.2/VSCode-linux-x64/resources/app/out/vs/workbench/workbench.desktop.main.js (660)
[1517735:0826/114338.019870:INFO:CONSOLE(660)] "%cDEBUG background: #eee; color: #888 Comments: URIs of continue on comments to add to storage .", source: vscode-file://vscode-app/opt/vscode/1.92.2/VSCode-linux-x64/resources/app/out/vs/workbench/workbench.desktop.main.js (660)
[1517735:0826/114355.716607:INFO:CONSOLE(660)] "%c WARN color: #993 Failed to fetch chat participant registry TypeError: Failed to fetch", source: vscode-file://vscode-app/opt/vscode/1.92.2/VSCode-linux-x64/resources/app/out/vs/workbench/workbench.desktop.main.js (660)

I'm guessing the TypeError warning is related to some kind of network timeout.

I can temporarily start VS Code with Internet access (albeit for a very short period of time). If I try to open the settings UI in this case, it populates immediately. This is why I'm assuming this is somehow related to network timeouts.

tudortimi commented 3 weeks ago

The same also happens for the extensions view:

image

With Internet, it loads instantly.

rzhao271 commented 2 weeks ago

Reassigning to @joyceerhl based on the "Failed to fetch chat participant registry" error.

joyceerhl commented 2 weeks ago

@rzhao271 I don't imagine that this has anything to do with chat participants. The problem here seems to be that we may not have the right timeouts configured for network requests, which results in our UI not appearing responsive. Reassigning to Sandeep for extensions view.

rzhao271 commented 2 weeks ago

Unable to repro on Windows 11. Does the issue still occur with extensions disabled?

tudortimi commented 2 weeks ago

Yes, it does. Many of my colleagues said they didn't see this with 1.86.x or something around that version.

tudortimi commented 2 weeks ago

Is there a way to add even more verbosity to the network calls? I was curious to see what URL are being hit. I tried with --log trace, but it didn't show anything extra.

rzhao271 commented 2 weeks ago

The "Developer: Toggle Developer Tools" command opens a devtools window which allows you to view network request under the Network tab.

tudortimi commented 2 weeks ago

I see the following (copied as cURL):

curl 'https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery' \
  -H 'sec-ch-ua: "Not-A.Brand";v="99", "Chromium";v="124"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Code/1.92.2 Chrome/124.0.6367.243 Electron/30.1.2 Safari/537.36' \
  -H 'content-type: application/json' \
  -H 'accept: application/json;api-version=3.0-preview.1' \
  -H 'Referer;' \
  -H 'x-market-client-id: VSCode 1.92.2' \
  -H 'sec-ch-ua-platform: "Linux"' \
  --data-raw '{"filters":[{"criteria":[{"filterType":7,"value":"GitHub.copilot"},{"filterType":8,"value":"Microsoft.VisualStudio.Code"},{"filterType":12,"value":"4096"}],"pageNumber":1,"pageSize":1,"sortBy":0,"sortOrder":0}],"assetTypes":[],"flags":950}'

and

curl 'https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery' \
  -X 'OPTIONS' \
  -H 'Accept: */*' \
  -H 'Access-Control-Request-Headers: content-type,x-market-client-id' \
  -H 'Access-Control-Request-Method: POST' \
  -H 'Origin: vscode-file://vscode-app' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Code/1.92.2 Chrome/124.0.6367.243 Electron/30.1.2 Safari/537.36'

The same requests are triggered also when running without extensions.

tudortimi commented 2 weeks ago

For "Timing", this is what is shown:

image

I tried to click on "Explanation", but I don't get anything.

tudortimi commented 2 weeks ago

If I start the same request manually with curl, they time out in 2m11s:

image

This is consistent with the "2.2 min" shown by VS Code. Is this perhaps an OS default which is different in Linux and Windows, hence the reason you don't see the problem on Windows 11?

nhaug commented 2 weeks ago

We have the same Problem.

Yes, it does. Many of my colleagues said they didn't see this with 1.86.x or something around that version.

It first showed up at our environment with 1.92.2 (with 1.92.1, we got no problem with the settings).

sandy081 commented 1 week ago

Can you please file a separate issue for Extensions View and investigate them separately. If we end up having same root cause then we can mark them as duplicates. As of now, I do not think they have same root cause. Both components should be rendered irrespective of network connectivity.

tudortimi commented 1 week ago

A similar issue also exists for the extensions view: #227446

tudortimi commented 1 week ago

I did some bisecting. The last version where settings loading works properly in our environment is 1.84.0. The first version where it becomes slow is 1.84.1.