Til

Force-stopping WSL when it gets stuck (with taskkill)

Sometimes WSL or Docker Desktop on Windows gets stuck. CPU usage spikes, RAM usage keeps growing, and commands like wsl --shutdown don’t seem to help.

In those situations I use a simple Windows command that force-kills the WSL service.

taskkill /f /im wslservice.exe

What it does

When this process is killed, Windows stops the underlying WSL VM and all running distributions.

When this is useful

This can help when:

After running the command, the next time you open WSL it will start a fresh VM instance.

Use with caution

This is a hard stop, not a graceful shutdown.

It will immediately terminate:

Possible side effects:

Because of that, it should be used only when normal shutdown methods fail.

Tip

Before force-killing WSL, try the normal shutdown command first:

wsl --shutdown

If that doesn’t work, taskkill /f /im wslservice.exe is usually the quickest way to recover a stuck WSL environment without rebooting Windows.

View original

#dev-tools #performance #troubleshooting #windows #wsl