WSL icon indicating copy to clipboard operation
WSL copied to clipboard

WSL randomly crashes and won't restart easily when using it with Docker Desktop

Open Erik-Sovereign opened this issue 7 months ago • 5 comments

Windows Version

Microsoft Windows [Version 10.0.26100.4351]

WSL Version

2.5.7.0

Are you using WSL 1 or WSL 2?

  • [x] WSL 2
  • [ ] WSL 1

Kernel Version

6.6.87.1-1

Distro Version

Ubuntu 24.04.11

Other Software

VS Code 1.101 with WSL extension 0.99.0 (I'm not sure if the crashes are related to this program) Docker Desktop (Windows) 4.41.2

Repro Steps

There are no clear reproduction steps, since WSL randomly crashes, except for also running Docker Desktop.

Expected Behavior

I expect that WSL does not crash and that I can continousely code in VS Code. When WSL crashes, I expect it to recover automatically or that I can restart it in an easy way.

Actual Behavior

The WSL distribution randomly crashes, while using it together with Docker Desktop. When it does, VS Code looses its connection and doesn't reconnect automatically because the WSL distribution doesn't restart automatically. When I "wsl --shutdown" it takes a long time before it actually does shutdown. Unfortunately it doesn't give me any feedback while doing the shutdown how long it will take or if if will ever shutdown. My typical usecase is, that I have VS Code and Docker Desktop running all the time, even though Docker Desktop isn't in active use most of the time. So most of the time there is no running container. Docker Desktop is also in my Windows autostart.

If I restart Windows, the WSL is still in a crashed state after the restart and Docker says, the connection to WSL has a problem. Even if I shutdown Windows and start it up again, WSL sometimes starts but crashes after some use in VS Code.

Diagnostic Logs

I followed https://github.com/Microsoft/WSL/blob/master/CONTRIBUTING.md#notes-for-collecting-wsl-logs, but "Enable automatic crash dump collection" unfortunately didn't collect anything. But "collect-wsl-logs.ps1" did.

WslLogs-2025-06-17_10-25-44.zip

When I tried to log something with WinDbg, it told me "Error: Process with Id 8384 has shadow stacks enforcement enabled and therefore is not supported for recording" as you see in the log.

wslservice01.txt

Erik-Sovereign avatar Jun 17 '25 08:06 Erik-Sovereign

Diagnostic information
Detected appx version: 2.5.7.0

github-actions[bot] avatar Jun 17 '25 08:06 github-actions[bot]

Same problem after updated to v2.5.7.0!

emaia avatar Jun 17 '25 12:06 emaia

Disabling Docker Desktop Resource Saver appears to resolve the issue for me. https://docs.docker.com/desktop/release-notes/#for-windows-1 https://github.com/docker/for-win/issues/14656

emaia avatar Jun 17 '25 14:06 emaia

Diagnostic information
Detected appx version: 2.5.7.0

github-actions[bot] avatar Jun 17 '25 14:06 github-actions[bot]

Disabling Docker Desktop Resource Saver appears to resolve the issue for me. https://docs.docker.com/desktop/release-notes/#for-windows-1 docker/for-win#14656

Thank you very much for reporting that to me. I will try that. I changed my ticket because I now also think, its a Docker Desktop problem. If activating ressource saver solves it, I will close this ticket, because then, for me, its the fault of Docker.

Erik-Sovereign avatar Jun 17 '25 14:06 Erik-Sovereign

Docker Desktop controls the virtual machine integrated with WSL2. The Resource Saver mode will freeze or suspend the related VM to save energy. After suspension, processes such as wslg, wslhost, and vmmem are all paused or have their resources restricted. During suspension, the Windows wsl.exe command and the underlying hypervisor may also become unresponsive.

Over7ure avatar Jun 20 '25 12:06 Over7ure

@Over7ure I'm not sure you are implying that but docker should not freeze/crash my Ubuntu WSL just because it uses it. I expect it to only change things related to WSL that concern Docker and only Docker.

But it's a docker problem, since my problem went away after disabling resource saver. So this is closed

Erik-Sovereign avatar Jun 20 '25 13:06 Erik-Sovereign

It only happens when you are using the WSL2 based engine in your docker desktop.

And since @OneBlue pinned this as "needs-author-feedback", you probably shouldn't close this issue.

Over7ure avatar Jun 20 '25 13:06 Over7ure

@Over7ure Sorry but I don't understand, why Docker can have any influence on my Ubuntu WSL distro, just because it uses WSL2? Do both use the same underlying kernel and can both influence it? Why are there not two kernels installed?

I thought @OneBlue refers to "If activating ressource saver solves it, I will close this ticket, because then, for me, its the fault of Docker." when he tagged that I should provide author feedback. If this is not the case, I would love to help solve the problem by providing more feedback

Erik-Sovereign avatar Jun 20 '25 13:06 Erik-Sovereign

I'd like to comment that I am also having this issue. I have multiple instances of VS code running with Ubuntu running under WSL in terminals on a Windows 11 PC with docker desktop installed and with WSL integration. Ubuntu is taken down hard and all of my instances of VS code crash. Re-starting VS Code, Ubuntu is no longer available in the drop down in vscode as an option. I need to start Ubuntu manually, close all instances of vs code, then re-open them and then ubuntu is available again. This is a recurring issue and resulting in significant loss of work / daily impact. Per @Erik-Sovereign, it is unclear why Docker can take down everything using WSL in this way. This seems like a bug vs. a feature.

mmercuri avatar Jun 27 '25 15:06 mmercuri

@mmercuri Thank you

Erik-Sovereign avatar Jul 14 '25 13:07 Erik-Sovereign

I'm experiencing the same/very similar issue where my entire WSL breaks/crashes and all open terminals attached get the following message:

[process exited with code 3221225786 (0xc000013a)] You can now close this terminal with Ctrl+D, or press Enter to restart.

It then takes 2-4 attempts at running "Docker Desktop" from the Start menu before it decides to actually open up the GUI app.

I don't have Resource Saver enabled, so disabling doesn't resolve my issue :( This happens when the computer is under load, when it's (seemingly) not under load, when I'm away from keyboard and in the middle of working in Neovim or VS Code. I haven't been able to link it to something specific I'm doing...

Any potential resolutions or workarounds?

OneBigOwnage avatar Aug 07 '25 12:08 OneBigOwnage

I notice this issue is closed, but the bug persists for me. Is there a resolution I am missing?

BerylCAtieno avatar Aug 31 '25 07:08 BerylCAtieno

Im also still seeing them.

On Sun, Aug 31, 2025, 12:41 AM Beryl Atieno @.***> wrote:

BerylCAtieno left a comment (microsoft/WSL#13124) https://github.com/microsoft/WSL/issues/13124#issuecomment-3239864273

I notice this issue is closed, but the bug persists for me. Is there a resolution I am missing?

— Reply to this email directly, view it on GitHub https://github.com/microsoft/WSL/issues/13124#issuecomment-3239864273, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANXPYZM6JXP777BKXFU5S33QKRJRAVCNFSM6AAAAAB7PQVAOGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEMZZHA3DIMRXGM . You are receiving this because you were mentioned.Message ID: @.***>

mmercuri avatar Sep 01 '25 00:09 mmercuri

I'd like to comment that I am also having this issue. I have multiple instances of VS code running with Ubuntu running under WSL in terminals on a Windows 11 PC with docker desktop installed and with WSL integration. Ubuntu is taken down hard and all of my instances of VS code crash. Re-starting VS Code, Ubuntu is no longer available in the drop down in vscode as an option. I need to start Ubuntu manually, close all instances of vs code, then re-open them and then ubuntu is available again. This is a recurring issue and resulting in significant loss of work / daily impact. Per @Erik-Sovereign, it is unclear why Docker can take down everything using WSL in this way. This seems like a bug vs. a feature.

i am having this EXACT issue.

halfsies1 avatar Oct 11 '25 22:10 halfsies1

I'm running wsl2 but not using Docker Dekstop, instead I'm using docker engine right inside the wsl2 to get less resource load, but it still happen right away, even though before this, it will go smoothly without any problem regardless how many vscode instances that I open, so I'm thinking that it is also related to current win 11 latest update or something, hopefully there is some solutions for this issue

FaircoreHD avatar Oct 27 '25 00:10 FaircoreHD

Resource-intensive tests are crashing wsl2 for me. I'm on Windows 11.

vg345 avatar Nov 13 '25 10:11 vg345