Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High CPU usage in Remote Desktop process with WSL2 + Ubuntu #9679

Open
ACERposS opened this issue Mar 19, 2024 · 6 comments
Open

High CPU usage in Remote Desktop process with WSL2 + Ubuntu #9679

ACERposS opened this issue Mar 19, 2024 · 6 comments
Assignees

Comments

@ACERposS
Copy link

ACERposS commented Mar 19, 2024

  • VSCode Version: 1.87.2
  • Local OS Version: Windows 10 Enterprise 22H2
  • Remote OS Version: Ubuntu 22.04.4
  • Remote Extension/Connection Type: WSL (VSCode extension v0.86.0)

I am getting high CPU usage and an unresponsive 'explorer' sidebar in VSCode in a project with somewhat deeply nested directories (React, not Java ;). The 'loading' animation at the top of the sidebar frequently displays, and some files & directories fail to open at all.

Possibly relevant detail: my workstation is managed by a domain administrator and has Windows Defender Smartscreen enabled and locked.

At the times in which the explorer hangs (mostly when renaming, copying or creating files through the explorer) I also see high CPU usage for the Remote Desktop process on my machine but no significant activity from any Nodejs process within WSL:

image

@aeschli
Copy link
Contributor

aeschli commented Mar 20, 2024

Likly not an issue in the explorer, but that's where I would start to profile.

The deep tree can cause a lot of file change events. Try excluding some files with the files.exclude and watcher.exclude setting. E.g. for JavaScipt we exclude the node_modules folder

@ACERposS
Copy link
Author

Yeah, I don't think it's anything within VSCode itself since I don't see high CPU usage in any node processes within WSL.

I can also confirm it's not related to open file handles (I have had this before but solved it). What I have is on the order of hundreds, not tens-of-thousands:

$ lsof | awk '{ print $1 " " $2; }' | sort -rn | uniq -c | sort -rn | head -15

    552 node 837555
    468 node 837278
    462 node 837212
    238 node 837599
    210 node 837234
    210 node 837225
     72 snapd 680670
     53 systemd 391
     24 python3.1 327

The first of these processes watching 552 files appears to be the extension host process, which is what I'd expect with a project running TypeScript intellisense & ESLint:

$HOME/.vscode-server/bin/863d2581ecda6849923a2118d93a088b0745d9d6/node --dns-result-order=ipv4first $HOME/.vscode-server/bin/863d2581ecda6849923a2118d93a088b0745d9d6/out/bootstrap-fork --type=extensionHost --transformURIs --useHostProxy=true

@ACERposS
Copy link
Author

Some additional information on this: I routinely receive this popup upon opening any WSL-connected application for the first time after a reboot. It must be dismissed 11 times to silence the warning.

Screenshot 2024-03-22 143801

I have found on some occasions when my machine was essentially unresponsive that this popup was a symptom. I have seen it silently open in the background hundreds of times (perhaps once for each watched file handle?). There appears to be some correlation between the number of popups and the severity of the filesystem performance impact.

@aeschli
Copy link
Contributor

aeschli commented Mar 26, 2024

How is Remote Desktop involved here? What I understood: You use Remove Desktop to connect to a Windows Machine that has WSL installed. On that Windows machine you run VS Code (under Window) with the WSL extension to work in WSL.

@ACERposS
Copy link
Author

ACERposS commented Mar 26, 2024

No. I don't (consciously) use Remote Desktop at all. It seems as though its process interferes with a default WSL2 configuration somehow.

All the processes in question are those I'm observing on my own local machine.

@stefanbischof
Copy link

Sorry to chime in here. I have a very similar issue on my machine. I have Docker configured to use WSL. A while after starting docker the "Remote Desktop" starts and consumes ~10% cpu. When I terminate the "Remote Desktop" in the task manager, it starts up again. Only when I shutdown wsl (and thereby kill Docker) I can then terminate "Remote Desktop" and it doesn't start again.

Sometimes I have several instances of Remote Desktop running. Although I think this is related to me using remote connections in VS Code. I think the same happens when I use dev containers. In these two cases it somehow makes sense that the "Remote Desktop" process shows up. But for Docker + WSL alone, I find it weird.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants