microsoft / WSL

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

WSL Freezes Randomly #10378

Open Rskut opened 11 months ago

Rskut commented 11 months ago

Windows Version

Microsoft Windows [Version 10.0.19045.3324]

WSL Version

1.2.5.0

Are you using WSL 1 or WSL 2?

Kernel Version

Linux version 5.15.90.1-microsoft-standard-WSL2

Distro Version

Ubuntu 20.04.6 LTS (GNU/Linux 5.15.90.1-microsoft-standard-WSL2 x86_64)

Other Software

PhpStorm 2023.2 Build #PS-232.8660.205, built on July 28, 2023 Rancher Desktop v. 1.7.0 and Kubernetes 1.25.6

Repro Steps

None, it just freeze randomly, sometimes after fresh reboot on initial start (does not start at all), sometimes after 7 hours working fine

Expected Behavior

No freeze

Actual Behavior

WSL freezes, so I have to shut it down with "wsl.exe --shutdown" and reboot it with "wsl -d Ubuntu" after it started up it works but it can crash at any time again.

Diagnostic Logs

WslLogs-2023-08-10_13-13-37.zip

abdiwahab88 commented 11 months ago

same here, wsl2 takes ages to start. some times become accessible after 2 hrs

Enselic commented 11 months ago

I also get this. Already running commands just pauses. Then I can't start new commands.

It tends to freeze for me during heavy load. I have a 16 core/32 thread system and for me it generally freezes when I run the Rust compiler test suite.

  1. Clone https://github.com/rust-lang/rust in WSL 2 Ubuntu.
  2. Run ./x test tests/ui

This puts heavy load on all 32 CPU threads. Sometimes WSL freezes in the middle for running the tests. Doing wsl.exe --shutdown and starting again resolves the issue.

I have used WSL 2 for many months. The freezes are a relatively new problem, first seen a few weeks back or so.

Rskut commented 11 months ago

WSL version 1.3.15.0 does not fix the issue.

Rskut commented 10 months ago

Any updates on this issue?. Are the logs helpful or not?

Enselic commented 10 months ago

After updating to the latest version of wsl I have not seen this problem. Not sure if it is luck or if the issue is fixed. I will report here if I see it again.

Enselic commented 10 months ago

I got the freeze again while running the Rust compiler test suite (see above). This is my current WSL version:

PS C:\Users\ensel> wsl --version
WSL-version: 1.2.5.0
Kernelversion: 5.15.90.1
WSLg-version: 1.0.51
MSRDC-version: 1.2.3770
Direct3D-version: 1.608.2-61064218
DXCore-version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows-version: 10.0.22621.2215
ozdang commented 10 months ago

I have the same issue ...

BenoitAnastay commented 9 months ago

Doing wsl.exe --shutdown and starting again resolves the issue.

Personally even this command is frozen and I have to kill the process, I'm not sure that we have the same issue behind our freezes

Rivgad commented 9 months ago

Doing wsl.exe --shutdown and starting again resolves the issue.

Personally even this command is frozen and I have to kill the process, I'm not sure that we have the same issue behind our freezes

Same to me. Frozen completely

tom-papatheodore commented 9 months ago

Same here. I typically reboot my computer to resolve the problem for a day or two : (

theHammi01 commented 9 months ago

same here, it happens too often even with low demand processes, or nothing running in the background

0xatulpatil commented 9 months ago

same issue here, this is relatively new issue. Had not faced this earlier. Even the wsl --shutdown command froze.

had to do taskkill /f /im wslservice.exe in order to quite the vmmen process.

cxammar commented 9 months ago

Same issue here, definitely makes me want to buy a mac

JesseTG commented 9 months ago

I have this issue as well. It tends to happen when compiling lots of code (C++, in my case).

xXTraceXx commented 8 months ago

I got this issue often if i am using vim.

christianhauschel commented 8 months ago

Happens to me also, probably especially when under heavy load...

I run simulations for several hours only to notice that WSL has freezed after 10 hours of calculations...

WSL-Version: 1.2.5.0
Kernelversion: 5.15.90.1
WSLg-Version: 1.0.51
MSRDC-Version: 1.2.3770
Direct3D-Version: 1.608.2-61064218
DXCore-Version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows-Version: 10.0.19045.3448

Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:        20.04
Codename:       focal
zoliweiss commented 8 months ago

Same here, when compiling big project. wsl --shutdown helps. Started noticing after our company moved to Windows Defender instead of Symantec AV.

polhenarejos commented 8 months ago

Same here when building with make -jN. Even it gets frozen only with -j3 (I have +16 cores).

WSL version: 1.2.5.0
Kernel version: 5.15.90.1
WSLg version: 1.0.51
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.3636
pstaunton commented 8 months ago

Same here - WSL hangs intermittently, even under light loads.

WSL version: 1.2.5.0
Kernel version: 5.15.90.1
WSLg version: 1.0.51
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.2846

UPDATE: my issue is resolved since my WSL auto-updated to version 2.X.

WSL version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.2846
KonstantinZhukov1992 commented 7 months ago

The same with building java projects.

WSL version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore versio: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.3570
RerikOp commented 7 months ago

Same here, noticing it when compiling a lot of code, great job ignoring this issue!

WSL-Version: 2.0.9.0
Kernelversion: 5.15.133.1-1
WSLg-Version: 1.0.59
MSRDC-Version: 1.2.4677
Direct3D-Version: 1.611.1-81528511
DXCore-Version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows-Version: 10.0.22621.2715
lity commented 7 months ago

Me too

WSL-Version: 2.0.9.0 Kernelversion: 5.15.133.1-1 WSLg-Version: 1.0.59 MSRDC-Version: 1.2.4677 Direct3D-Version: 1.611.1-81528511 DXCore-Version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows-Version: 10.0.22631.2715

rimmer commented 7 months ago

Similar issue. Usually happens when running an Alpine based devcontainer inside VSCode for a while, couple of hours usually. WSL version: 2.0.9.0 Kernel version: 5.15.133.1-1 WSLg version: 1.0.59 MSRDC version: 1.2.4677 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22631.2715

WslLogs-2023-11-20_21-59-42.zip

ariesdevil commented 7 months ago

Same issue when build databend

WSL version: 2.0.9.0 Kernel version: 5.15.133.1-1 WSLg version: 1.0.59 MSRDC version: 1.2.4677 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22621.2715

OliverKersting commented 7 months ago

I have the same issue

KonstantinZhukov1992 commented 7 months ago

I've found the solution. In my case the reason was that the directory with the code was on windows disk. I've copied on linux filesystem and now it works fine

jwellbelove commented 7 months ago

I get this a lot recently when running my Linux unit test scripts for GCC and Clang.

WSL version: 2.0.9.0 Kernel version: 5.15.133.1-1 WSLg version: 1.0.59 MSRDC version: 1.2.4677 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.19045.3693

adibacco commented 7 months ago

I have exactly same problem, especially when running vscode attached to the WSL instance. wsl --shutdown does NOT help I need to do this: taskkill /f /im wslservice.exe as administrator

zoliweiss commented 7 months ago

Looks like the common denominator in all cases is the Windows FS access.

adibacco commented 7 months ago

I hope that Microsoft finds a solution because this bug is around since three/four months and it is very annoying

ayalon commented 7 months ago

I have the same issue. It usually happens if a lot of file operations are involved.

jwellbelove commented 7 months ago

I have an AMD FX-8350 Eight-Core Processor If I run my CMAKE CI scripts with 6 concurrent threads WSL2 randomly freezes. If I drop back to 4 then I don't seem to see a problem. It's possible this may be due to concurrent operations on files in the Windows directories.

Rskut commented 7 months ago

Today was the first day in months I experienced no freezes after updating to version 2.0.12, as someone mentioned here: https://github.com/microsoft/WSL/issues/8824

zouyonghao commented 6 months ago

Same here.

But I think I found related issues: I use Clion for a project. Every time I try to compile the project (a large cmake project), then the disk usage is up to 100%, and the whole gui freezes. The bash can work, but extremely slow.

PS > wsl --version
WSL 版本: 2.0.9.0
内核版本: 5.15.133.1-1
WSLg 版本: 1.0.59
MSRDC 版本: 1.2.4677
Direct3D 版本: 1.611.1-81528511
DXCore 版本: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows 版本: 10.0.22631.2861
ShayBox commented 6 months ago

Been experiencing this for years at this point, the only option for me is to switch Docker for Windows back to Hyper-V instead of WSL, It's completely unusable when it freezes every WSL instance every time I try and compile something.

If you want to recreate this, compile any rust project with a few hundred dependencies (tree) in WSL, it happens every time.

marchello2000 commented 6 months ago

Same issue here:

PS C:\Users\markv> wsl.exe --version
WSL version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.2861

Also during heavier loads

ajkessel commented 6 months ago

Ditto here. Seems to be happening more frequently lately. I tried to update to the latest WSL pre-release but it doesn't help. wsl --shutdown just hangs but taskkill /f /im wslservice.exe is successfully, but I still can't restart after that, I get Failed to attach disk '[path to my ext4].vhdx' to WSL2: The process cannot access the file because it is being used by another process. Error code: Wsl/Service/CreateInstance/MountVhd/HCS/ERROR_SHARING_VIOLATION. And then I see two vmmem processes.

It's often happening when there is no window open, but maybe some background cron jobs happening. Since I can't get in to the instance to run ps, it's hard to see what the cause might be.

WSL version: 2.1.0.0
Kernel version: 5.15.137.3-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.3803

I ran collect-wsl-logs.ps1 while this was happening and would be happy to provide the ZIP if there is a nonpublic place to submit it.

crhf commented 5 months ago

Same here. Happens every day after I ssh into a remote server for a while.

WSL 版本: 2.0.6.0
内核版本: 5.15.133.1-1
WSLg 版本: 1.0.59
MSRDC 版本: 1.2.4677
Direct3D 版本: 1.611.1-81528511
DXCore 版本: 10.0.25880.1000-230602-1350.main
Windows 版本: 10.0.19045.3930
IwishIcanFLighT commented 5 months ago

I also have these random freezes occurring quite frequently and just found a reliable way to trigger one while installing a local instance of Ghost blog.

  1. From WSL shell, cd into a folder located in a host disk such as /mnt/c/Users/<user>/Desktop/ghost_blog
  2. Run ghost install --local, which will fail during step 4/5 Linking Dependencies, roughly 1 minute into the install process.
  3. From this point, WSL becomes very slow and can't access host's disks anymore (hangs). The only way to restore it is to either wsl --shutdown or reboot the host computer.

Note: I tested the exact same install of Ghost from WSL's /tmp/ghost_blog and it worked flawlessly.

wsl --version output:

Version WSL : 2.0.14.0
Version du noyau : 5.15.133.1-1
Version WSLg : 1.0.59
Version MSRDC : 1.2.4677
Version direct3D : 1.611.1-81528511
Version de DXCore : 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Version de Windows : 10.0.19045.3930

Hopes this help debugging the issue.

techknowfile commented 5 months ago

Same here. Running a media server stack through WSL2 with an ext4 drive mounted. Downloading media files through WSL2 onto the drive quickly results in the entire thing freezing up, and I'm unable to open new terminals, unable to run any wsl commands, and if I taskkill, I'm still unable to restart wsl without a reboot

WSL version: 2.0.14.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.3007
vmnit commented 5 months ago

Same here. Facing keyboard input freeze after every one command. Even facing issue with the same frequent freeze while writing in the nvim.

wsl shutdown seems to be overkill. It seems that some service is getting high priority over the keyboard input, and that is causing these frequent freezes. Not sure, if there is a setting which can help here.

If anyone has any solution, please share.

Nerd10000 commented 3 months ago

I am having the same issue but its usually happens when I launch Intellij and work with my java project and listen music or a video in the background and my mouse just randomly freeze.I tried everything update drivers it fixed a small amount of issues but it still annoys me.

rsov commented 3 months ago

When booting up some dev containers in vscode

WSL version: 2.1.5.0
Kernel version: 5.15.146.1-2
WSLg version: 1.0.60
MSRDC version: 1.2.5105
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22631.3296
Hurricane31337 commented 3 months ago

I still have the same problem, even on the latest 2.2.1 pre-release (wsl --update --pre-release).

My major pain point where this problem occurs is quantization of LLM models using llama.cpp:

I have a workstation with Nvidia GPUs, so my steps are for using CUDA 12.4 and the LLM model WizardLM-70B-V1.0. To reproduce it you will need an RTX 30 series card or newer and around 500GB of free space. I guess it will also happen for other configurations but I only describe my repro. The last step (./llama.cpp/build/bin/quantize) hangs for me 100% or the time and therefore the WSL setup is completely unusable for me.

Open Ubuntu Terminal, cd to a folder of your choice (Downloads maybe) and then:

sudo apt remove libcudart11.0 nvidia-cuda-dev nvidia-cuda-gdb nvidia-cuda-toolkit nvidia-cuda-toolkit-doc
sudo apt autoremove
sudo apt install nvidia-cuda-toolkit
sudo apt install cmake git
git lfs install

git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp/
mkdir build
cd build/
cmake .. -DLLAMA_CUDA=ON
cmake --build . --config Release -j 64
cd ../../

git clone https://huggingface.co/WizardLM/WizardLM-70B-V1.0
mkdir WizardLM_WizardLM-70B-V1.0-GGML.FP16
python llama.cpp/convert.py WizardLM_WizardLM-70B-V1.0/ --outtype f16 --outfile WizardLM_WizardLM-70B-V1.0-GGML.FP16/wizardlm-70b-v1.0.ggmlv3.bin
mkdir WizardLM_WizardLM-70B-V1.0-GGUF.Q8
./llama.cpp/build/bin/quantize WizardLM_WizardLM-70B-V1.0-GGML.FP16/wizardlm-70b-v1.0.ggmlv3.bin WizardLM_WizardLM-70B-V1.0-GGUF.Q8/wizardlm-70b-v1.0-q8_0.gguf Q8_0

My .wslconfig (384GB RAM + 2x Xeon 4216, Windows 11 keeps 16GB + 1 CPU core / 2 threads so it can't hang):

[wsl2]
memory=368GB
processors=62

[experimental]
autoMemoryReclaim=gradual

wsl --version

WSL-Version: 2.2.1.0
Kernelversion: 5.15.150.1-2
WSLg-Version: 1.0.60
MSRDC-Version: 1.2.5105
Direct3D-Version: 1.611.1-81528511
DXCore-Version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows-Version: 10.0.22621.3296
16u commented 3 months ago

Same here when im starting a react npm application

WSL-Version: 2.1.5.0 Kernelversion: 5.15.146.1-2 WSLg-Version: 1.0.60 MSRDC-Version: 1.2.5105 Direct3D-Version: 1.611.1-81528511 DXCore-Version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows-Version: 10.0.19045.4170

peterhorsley commented 1 month ago

Same here after a fresh install of WSL. Rebooting doesn't fix. Reinstalling WSL doesn't fix. If i try to start a distro, it finally launches after about an hour. But fresh install of docker fails to start docker engine, giving WSL error. There really needs to be some way to troubleshoot this issue, just freezing with no error is very frustrating.

WSL version: 2.1.5.0 Kernel version: 5.15.146.1-2 WSLg version: 1.0.60 MSRDC version: 1.2.5105 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.19045.4291

ERRORthenBSOD commented 1 month ago

For me the problem was me forgetting to set newly installed distro to default, because i also have docker wsl. So maybe it will help you too wsl -s <DistributionName>

foloinfo commented 1 month ago

In my case, the problem was that I didn't have any free space on the system. Might be worth checking the file system?

ms-afk commented 2 weeks ago

In my case, the problem was that I didn't have any free space on the system. Might be worth checking the file system?

This was also the case for me, I was installing a very big package and the system space was very low.

rdp commented 1 week ago

wsl --update and reinstalling the distro help?