microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.4k stars 819 forks source link

WSL2 randomly terminates when doing VS Code searches #5939

Closed ccarlsonpb closed 8 months ago

ccarlsonpb commented 4 years ago

Environment

Windows build number: Win32NT 10.0.20170.0 Microsoft Windows NT 10.0.20170.0

Your Distribution version: Release: 18.04

Whether the issue is on WSL 2 and/or WSL 1: Linux version 4.19.104-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Feb 19 06:37:35 UTC 2020

Steps to reproduce

Originally filed as a vscode issue here https://github.com/microsoft/vscode/issues/106139, but seems like it's an issue with WSL itself. Basically, every couple of days or so, I will begin a project-wide search operation in vs code, and this will cause WSL to terminate. All of my open terminals will close, docker for windows will say that WSL has stopped, etc. Basically, vs code is the catalyst, but the entirety of WSL shuts down.

So far, I have only been able to trigger this crash by using the project search feature of vs code, but I can't intentionally reproduce the crash; Searching works fine for days at a time, but eventually I will begin a search and then WSL will crash.

Expected behavior

I'm expecting WSL not to terminate on its own.

Actual behavior

WSL randomly terminates.

reinaldocoelho commented 4 years ago

I have the same problem here. When running or debugging React/Dotnet with VsCode over WSL the program stops to work. VsCode display an Reconnecting modal and the command line over WSL freezes. If I open a prompt (powershell) and run docker ps, the command not respond until some automatic "restart" occours.

If I open the Task Manager, VMMEM consume a higth CPU and use all configured memory to it (6GB).

I canΒ΄t get the steps to reproduce too. :-(

ziyunxiao commented 4 years ago

I have similar issues. And it is very difficult to reproduce. It crashed my host (Windows) 3 times.

  1. Running upgrade of vscode, during vscode restart it crashes the host. inside Linux(Ubuntu 20.04)
  2. Running vscode inside Linux and don't know what reason it crashes.
  3. Running script to build a docker image inside Linux(Ubuntu 20.04) it crashes the host(Windows) again. It looks like related to steps to access the Windows files system where the docker image stored at (C:/Programdata/dockerDesktop/) . But the error could not be reproduced every time.

Anyway, this is just a comment here. Hopefully, this can give some clue that the support team can find the root cause.

Thanks very much to the team who make WSL2.

ccarlsonpb commented 4 years ago

So, a week or two ago I tried this workaround - an entry in %USERPROFILE%\.wslconfig

[wsl2]
memory=8GB
processors=3

This is on my machine with 16GB RAM, 4 cores and it seems to have helped quite a bit. I think I haven't had the crashing issue since I made this change. To me it seems like WSL2 is too greedy by default and ends up starving the host of all available resources, which creates a deadlock and ends up killing WSL2 itself.

ziyunxiao commented 4 years ago

@ccarlsonpb Thank you for the info. I will try out your workaround.

benhillis commented 4 years ago

If somebody is able to reproduce this, could you please run with the WSL debug console on? I'd be curious about what's happening in the log when WSL terminates.

Add this line to %userprofile%.wslconfig

[wsl2]
debugConsole=true

Note: this will make the VM boot slower so you'll want to disable this after you're done.

mkymikky commented 3 years ago

I can reproduce a similar behaviour with transferring encrypted and deduplicated data via borg to another computer via ssh. This reproduces termination without message while synchronizing the borg cache.. Where can I obtain the generated logs?

microsoft-github-policy-service[bot] commented 8 months ago

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!