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 Freezes Randomly #10378

Open
1 of 2 tasks
Rskut opened this issue Aug 10, 2023 · 52 comments
Open
1 of 2 tasks

WSL Freezes Randomly #10378

Rskut opened this issue Aug 10, 2023 · 52 comments

Comments

@Rskut
Copy link

Rskut commented Aug 10, 2023

Windows Version

Microsoft Windows [Version 10.0.19045.3324]

WSL Version

1.2.5.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

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
Copy link

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

@Enselic
Copy link

Enselic commented Aug 12, 2023

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
Copy link
Author

Rskut commented Aug 14, 2023

WSL version 1.3.15.0 does not fix the issue.

@Rskut
Copy link
Author

Rskut commented Aug 30, 2023

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

@Enselic
Copy link

Enselic commented Aug 30, 2023

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
Copy link

Enselic commented Sep 3, 2023

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
Copy link

ozdang commented Sep 14, 2023

I have the same issue ...

@BenoitAnastay
Copy link

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
Copy link

Rivgad commented Sep 16, 2023

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
Copy link

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

@theHammi01
Copy link

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

@0xatulpatil
Copy link

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
Copy link

cxammar commented Oct 10, 2023

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

@JesseTG
Copy link

JesseTG commented Oct 11, 2023

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

@xXTraceXx
Copy link

I got this issue often if i am using vim.

@christianhauschel
Copy link

christianhauschel commented Oct 18, 2023

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
Copy link

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

@polhenarejos
Copy link

polhenarejos commented Nov 8, 2023

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
Copy link

pstaunton commented Nov 10, 2023

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
Copy link

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
Copy link

RerikOp commented Nov 15, 2023

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
Copy link

lity commented Nov 18, 2023

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
Copy link

rimmer commented Nov 20, 2023

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
Copy link

ariesdevil commented Nov 22, 2023

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
Copy link

I have the same issue

@KonstantinZhukov1992
Copy link

KonstantinZhukov1992 commented Nov 24, 2023

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
Copy link

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
Copy link

adibacco commented Dec 4, 2023

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
Copy link

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

@adibacco
Copy link

adibacco commented Dec 4, 2023

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

@ayalon
Copy link

ayalon commented Dec 6, 2023

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

@jwellbelove
Copy link

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
Copy link
Author

Rskut commented Dec 6, 2023

Today was the first day in months I experienced no freezes after updating to version 2.0.12, as someone mentioned here: #8824

@zouyonghao
Copy link

zouyonghao commented Dec 14, 2023

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
Copy link

ShayBox commented Dec 14, 2023

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.

@github-actions github-actions bot mentioned this issue Jan 8, 2024
2 tasks
@marchello2000
Copy link

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
Copy link

ajkessel commented Jan 9, 2024

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
Copy link

crhf commented Jan 26, 2024

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
Copy link

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
Copy link

techknowfile commented Feb 1, 2024

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
Copy link

vmnit commented Feb 10, 2024

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.

@github-actions github-actions bot mentioned this issue Mar 1, 2024
2 tasks
@Nerd10000
Copy link

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
Copy link

rsov commented Mar 28, 2024

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
Copy link

Hurricane31337 commented Apr 1, 2024

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
Copy link

16u commented Apr 11, 2024

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
Copy link

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
Copy link

ERRORthenBSOD commented May 13, 2024

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
Copy link

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
Copy link

ms-afk commented Jun 20, 2024

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
Copy link

rdp commented Jun 26, 2024

wsl --update and reinstalling the distro help?

@HuaHuaY
Copy link

HuaHuaY commented Jun 27, 2024

I fix my wsl freeze by following #11066 (comment) .

Change autoMemoryReclaim from gradual to dropcache

@miroi
Copy link

miroi commented Jul 17, 2024

My "ase gui" graphics application of https://wiki.fysik.dtu.dk/ase/index.html is giving frozen windows ...I have the updated WSL and Ubuntu 22.04LTS. What can be wrong ? See also https://gitlab.com/ase/ase/-/issues/1511 , this is for "ase gui".

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