microsoft / WSL

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

WSL is non-responsive after waking from hibernate #8696

Open roja45 opened 1 year ago

roja45 commented 1 year ago

Version

Windows 11 Pro 21h2 build 22000.832

WSL Version

Kernel Version

5.10.60.1

Distro Version

Ubuntu 2-.04

Other Software

Docker desktop windows

Repro Steps

Hibernate machine Start up windows open a new terminal

Expected Behavior

Shouldn't hang

Actual Behavior

No response, terminal hangs. wsl --shutdown from command prompt also hangs, only solution is to restart the machine.

Diagnostic Logs

No response

roja45 commented 1 year ago

image

roja45 commented 1 year ago

image

roja45 commented 1 year ago

WslLogs-2022-08-08_08-43-05.zip

logs captured while trying to restart wsl

NickDeBeenSAE commented 1 year ago

WSL has found it hard to reconnect to the PC's storage by the sounds of things.

The next time this happens, I believe restarting WSL will fix it, as it does appear to have a memory leak as well.

Close then re-open is what I meant by this.

roja45 commented 1 year ago

But how do I restart wsl? wsl --shutdown just hangs.

NickDeBeenSAE commented 1 year ago

You close it.

Then you re-open it.

NickDeBeenSAE commented 1 year ago

If it won't close, open task manager then kill the process from there.

david-dlc-cerezo commented 1 year ago

Same happens to me, no posible to wsl --shutdown, it hangs as well. The only solution is to restart windows, what is is quite annoying.

QuentinLemCode commented 1 year ago

Hello Same issue for me, the wsl command hangs at each command image

Edit : I managed to relaunch it without restarting windows by killing all wsl processes in task manager

roja45 commented 1 year ago

I don't think this is related to hibernation, I was also using PHPStorm (latest version which was supposed to have fixed a bug with WSL). I have finally abandoned PHPStorm and have been using VSCode for the last week or so, and no more problems with WSL crashing, it has been rock solid ever since.

pnmcosta commented 1 year ago

I'm on 22000.918 I do get an error after hibernate wake: image

Only a full restart fixes it! 👎

rowleya commented 1 year ago

On Windows OS Build 22000.918, I am also getting a freeze of WSL2 on return from hibernate. CPU use is high: image

I also can't stop the service: image

WSL doesn't respond at all (listing doesn't work, status doesn't work, version doesn't work): image

I am using the latest WSL release 0.66.2.

Restart works to bring things back but that is all that works.

egorgam commented 1 year ago

rowleya you may to try update Docker Desktop for last version (v4.12) https://github.com/microsoft/WSL/issues/8703

In my case I have same problems with WSL2 and hibernate behavior. I tried to turn off hibernation but looks like my laptop dont support S1-S3 sleep mode. So updating the Docker fixed vmmem leak, but not wsl2 stucks after waking up.

rowleya commented 1 year ago

I don't have Docker Desktop installed here as I use docker on WSL2 when needed. Note that there isn't a vmmem memory leak here; that is just how much memory I am using!

Of interest, I usually use eclipse within WSL2 and leave that running when hibernating. That had been working until recently, but with the issue, it also meant that the CPU usage of VMMem went very high when restoring from hibernate. On Friday I closed eclipse before hibernating, and on coming back this morning, the high CPU is gone, but WSL still won't start up again without a restart of the computer.

rowleya commented 1 year ago

OK, even more interesting, I saw a thread about collecting wsl logs, so I tried to do that this morning, running the process just before hibernating. It seems that the issue didn't then show up. I don't know if this means that it is something to do with the amount of time of hibernation or something... I will try to remember to run the logging process tonight again and see what happens tomorrow...

genmeblog commented 1 year ago

It happens also to me:

WSL: 0.66.2.0 Kernel: 5.15.57.1 WSLg: 1.0.42 MSRDC: 1.2.3401 Direct3D: 1.606.4 DXCore: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows: 10.0.22000.918

After hibernation (not sleeping), VmmemWSL eats 100% CPU, there is no way to shutdown, terminate or restart. I also do not see any memory leaks (memory usage is reasonable).

rowleya commented 1 year ago

"Working" was said a bit too soon. It was running, but it was slow! A restart has fixed that again, but I do wonder if something is slowing things down with hibernate and then by the time it comes back (if overnight for example), it has slowed down to basically nothing at all...

genmeblog commented 1 year ago

OK, even more interesting, I saw a thread about collecting wsl logs, so I tried to do that this morning, running the process just before hibernating. It seems that the issue didn't then show up. I don't know if this means that it is something to do with the amount of time of hibernation or something... I will try to remember to run the logging process tonight again and see what happens tomorrow...

I observe exaclty the same thing. After I turned on logging, wsl doesn't hang...

saschagysel commented 1 year ago

Having the same issue. It must have started probably after a Windows Update around 2-3 weeks ago as it worked before.

rowleya commented 1 year ago

As expected, WSL had frozen on return from hibernate this morning. I have attached the logs gathered during this time, started just before I entered hibernate, and stopped after returning; I did also try to start a WSL terminal just before stopping to ensure it was frozen. Eclipse was also open during this time but non-responsive on return (I could see the window and contents, but couldn't do anything with them).

The logs are attached below: WslLogs-2022-09-12_16-38-51.zip

rowleya commented 1 year ago

From the log, it seems the issue is likely related to the Microsoft Windows Host Network Interface Service, onRundown event, which seems to go into some sort of overdrive...

rowleya commented 1 year ago

Progress this morning. Further investigation of the virtual network interfaces, I seemed to have VirtualBox installed. I think this was installed by an IT administrator when they set up my laptop as I didn't install it myself. Anyway, having removed this, it seems that things are better on resume from hibernate. WSL is still responsive, though Eclipse was still running poorly. Restarting WSL seemed to then fix all the speed issues, which is a big step up from having to restart the machine!

deeep commented 1 year ago

( same issue... uninstalling last win11 update "helped" )

jheinzel commented 1 year ago

I observe more or less the same behavior. My configuration:

Behavior

"Workaround"

rowleya commented 1 year ago

I did another Windows update yesterday and am now on 10.0.22000.978. Unfortunately this seems to have brought back the issue again; once again the system resumes from hibernate with VmmemWSL running at high CPU but all of WSL being non-responsive.

This time I managed to find a better workaround than restarting the PC though. If I kill the "Windows Subsysem for Linux Preview" process then WSL stops. I then have to manually start the LxssManager process which appears to have stopped (maybe this is the cause of the issue?). Once I do this, I can once again start WSL as if nothing had happened.

I note that LxssManager is set to start "Manual". I don't know if this is the correct setting, but then I can't change it to "Automatic" as I get an error "Access Denied" if I try. Any comments on this front are welcome...

cringegnere commented 1 year ago

Same issue here on my laptop after hibernation. Windows 11 21H2 Build 22000.978

JoshuaJWilborn commented 1 year ago

Having the same issue. Build 22000.978

OrangePixelLtd commented 1 year ago

Started happening to me just after the last windows update. Build 22000.978

gyaaniguy commented 1 year ago

This time I managed to find a better workaround than restarting the PC though. If I kill the "Windows Subsysem for Linux Preview" process then WSL stops. I then have to manually start the LxssManager process which appears to have stopped (maybe this is the cause of the issue?). Once I do this, I can once again start WSL as if nothing had happened.

Thank you! Works for me. Key is to close all wsl* processes image Then start the service net start LxssManager

vindolin commented 1 year ago

Same problem here on Build 22000.978, wsl --shutdown appears to be hanging for about a minute but then finishes and everything works again.

angelorlov commented 1 year ago

I uninstalled the latest update for build 22000.978 and the problem went away

rowleya commented 1 year ago

I believe that the issue started in 22000.918, but that was only a preview so it won't have installed automatically. I don't know for sure but would guess that if you installed 22000.918 before 22000.978, you would likely need to remove both.

ThijsBroersen commented 1 year ago

Having the same issue for some time now. Very disappointing and annoying.

Edition Windows 11 Pro
Version 21H2
OS build    22000.978
angelorlov commented 1 year ago

I believe that the issue started in 22000.918, but that was only a preview so it won't have installed automatically. I don't know for sure but would guess that if you installed 22000.918 before 22000.978, you would likely need to remove both.

I thought so too at first, but restarting the PC twice was enough

jonatanschroeder commented 1 year ago

I'm having the same issue. About wsl --shutdown stalling, my experience is that it just takes a while (a minute or two), but then it works (so no need to restart the computer, but need to restart WSL). Still not ideal since this requires me to restart my containers and reset my environment and open terminal tabs.

miltonjonat commented 1 year ago

Same here. Freezes after Hibernation, and restarting Windows fixes it. I also have the same experience as @jonatanschroeder: running wsl --shutdown does work, it only takes a couple of minutes. Thanks for pointing that out, it is still very annoying but much better than restarting Windows!

Windows: 10.0.22000.978
Kernel:  5.10.102.1
cringegnere commented 1 year ago

Same issue here on my laptop after hibernation. Windows 11 21H2 Build 22000.978

Updated now to Build 22000.1042, let's see if something has changed

jheinzel commented 1 year ago

Same issue here on my laptop after hibernation. Windows 11 21H2 Build 22000.978

Updated now to Build 22000.1042, let's see if something has changed

I also did the upgrade to 22000.1042 yesterday. This morning I observed the issue again. Very disappointing ...

Lybecker commented 1 year ago

Same problem on 10.0.22000.978

rowleya commented 1 year ago

I have now updated to 22000.1042 and WSL 0.67.6 and after all restarts etc. last night I put the computer into Hibernate and this morning it woke up without any issues, and eclipse is still running and not slow. I don't think I have done anything else. I note that LxssManager is back to being in Manual mode and is stopped, but that doesn't seem to stop WSL working...

danbrice commented 1 year ago

Same here, WSL hangs, 100% CPU after waking from hibernate, wsl --shutdown just hangs. I never had the problem before, seemed to start after the latest windows updates: 2022-09 Cumulative Update for Windows 11 for x64-based Systems (KB5017328) 2022-09 Cumulative Update for .NET Framework 3.5, 4.8 and 4.8.1 for Windows 11 for x64 (KB5017497) Windows Intelligence Update

I'm on windows build: 22000.978 / 1000.22000.978.0

WSL version: 0.66.2.0 Kernel version: 5.15.57.1 WSLg version: 1.0.42 MSRDC version: 1.2.3401 Direct3D version: 1.606.4 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22000.978

OrangePixelLtd commented 1 year ago

I updated to 22000.1042 and it seems that it's ok now. It's only been a day so I will report any issues. I haven't had time to try anything else so it looks like it was the update,

danbrice commented 1 year ago

This time I managed to find a better workaround than restarting the PC though. If I kill the "Windows Subsysem for Linux Preview" process then WSL stops. I then have to manually start the LxssManager process which appears to have stopped (maybe this is the cause of the issue?). Once I do this, I can once again start WSL as if nothing had happened.

Thanks @rowleya this works for me too. I don't think I normally have LxssManager running and didn't need to start it. WSL just straight back up.

miltonjonat commented 1 year ago

I updated to 22000.1042 and it seems that it's ok now. It's only been a day so I will report any issues. I haven't had time to try anything else so it looks like it was the update,

I'm also not seeing the issue anymore. Upgraded recently to 10.0.22621.521.

danbrice commented 1 year ago

I'm still on 10.0.22000.978 and it hasn't happened to me over the last 3 days, all since I killed the "Windows Subsysem for Linux Preview" - not sure if that is what helped, but it was very consistent before that.

suwidadi commented 1 year ago

mine also still on 22000.978 but still experience the error after hibernating. sometimes Get-Service LxssManager | Restart-Service is working and some time is not.

galiovsky commented 1 year ago

I still experience this on 10.0.22000.1042 with WSL 0.67.6.0, kernel 5.15.62.1. It doesn't happen on every wake up, but neither it did before.

civanescu commented 1 year ago

I have the same issue, it rised up last week.

Because it keeps my CPU to 100%, I set it in .wslconfig to only 4 processors, now I have control to the system but the things inside containers runs slower. I have disabled guiApplications and tried the WIN+CTRL+SHIFT+B but no effect.

civanescu commented 1 year ago

Update "KB5017383" seems to solve the situation.

galiovsky commented 1 year ago

Update "KB5017383" seems to solve the situation.

As mentioned above, it does not in my case. YMMV