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

WSL 2: VSCode keeps crashing with error "WebSocket close with status code 1006" #201612

Closed
ClementNerma opened this issue Dec 29, 2023 · 8 comments
Assignees
Labels
info-needed Issue requires more information from poster

Comments

@ClementNerma
Copy link

ClementNerma commented Dec 29, 2023

  • VS Code Version: 1.85.1 (Stable, not Insiders)
  • OS Version: Windows_NT x64 10.0.22631, Windows 11 Professional
  • OS channel: Stable (not Insiders)
  • WSL Version: 2.0.5.0
  • WSL kernel version: 5.15.133.1-1
  • WSL OS: Ubuntu 23.10

Steps to Reproduce:

  1. Open a WSL directory in VSCode
  2. After a few minutes, VSCode crashes invariably

I used to have this error from time to time for a long time, but since very recently it's become frequent to the point I can't use VSCode for more than ~5 minutes without it crashing. I don't recall doing anything particular recently to either Windows or WSL.

I have this problem on my laptop too, which has the same Windows and WSL version, same OS etc.

Forcefully restarting VSCode does not solve the problem, only shutting down WSL does, but the problem appears again after a few minutes.

Here is an extract from the error logs:

ENOPRO: No file system provider found for resource 'vscode-remote://wsl%2Bubuntu/home/clement/Projets/AutoDotFiles2': CodeExpectedError: ENOPRO: No file system provider found for resource 'vscode-remote://wsl%2Bubuntu/home/clement/Projets/AutoDotFiles2'
WebSocket close with status code 1006: CodeExpectedError: WebSocket close with status code 1006

Here is a more complete screenshot:

image

Note that clicking on "Open in browser" in the error tooltip the browser opens the http://127.0.0.1:52599/version URL which results in a "connection reset" error in Firefox.

EDIT: I also tried removing ~/.vscode-server, but this didn't help.

@aeschli
Copy link
Contributor

aeschli commented Jan 8, 2024

Can it be a performance problem of the distro that causes the VS Code server to stall? Too much memory used or the CPU running hot?
When the connection terminates, can you check the task manager if there's something abnormal?

@aeschli aeschli added the info-needed Issue requires more information from poster label Jan 8, 2024
@ClementNerma
Copy link
Author

Nope, CPU usage is low, RAM as well.

I'm using a Ryzen 7900 with 64 GB of RAM ad it happens even without any heavy process running.

@aeschli
Copy link
Contributor

aeschli commented Jan 9, 2024

Is there anything special in the WSL log (Run: WSL: Show Log..) the Remote server log (Run: Developer: Open Log File ... Server) or the Remote Extension Host Log (Run: Developer: Open Log File ... Extension Host (Remote))?

Also when the connection disappears, is the remote server still running? In the WSL terminal run ps -ax | grep code

@ClementNerma
Copy link
Author

I'll try when I get home ; in the meantime I'm working with the SSH extension by exposing an SSH server on WSL and connecting to it through VSCode, which works flawlessly.

@shscs911
Copy link

Following the instructions from WSL Issue #9360 and Issue #10752 fixed it for me.

  • Add the following to .wslconfig in your %USERPROFILE% directory:
[wsl2] 
virtio9p=false
  • Run wsl.exe --shutdown and open a WSL instance after 8 seconds.

@ClementNerma
Copy link
Author

Didn't know that configuration option existed ; I'll try that, thanks :)

@vscodenpa
Copy link

Hey @aeschli, this issue might need further attention.

@ClementNerma, you can help us out by closing this issue if the problem no longer exists, or adding more information.

@ClementNerma
Copy link
Author

Note to others: I switched to another solution in the meantime (using SSH connection to WSL 2) and it's been working flawlessly.

@microsoft microsoft locked and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

4 participants