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 die after laptop sleep and can't be reopened #9301

Closed
1 of 2 tasks
Ansuel opened this issue Dec 10, 2022 · 21 comments
Closed
1 of 2 tasks

Wsl die after laptop sleep and can't be reopened #9301

Ansuel opened this issue Dec 10, 2022 · 21 comments

Comments

@Ansuel
Copy link

Ansuel commented Dec 10, 2022

Version

Windows: [10.0.25252.1010]

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.15.79.1

Distro Version

Ubuntu from store (with apt sources set to devel and package updated)

Other Software

No response

Repro Steps

  1. Open WSL cmd from Windows Terminal
  2. Open explorer.exe on a WSL directory
  3. Put laptop to sleep
  4. Notice Windows Terminal window closed
  5. Notice explorer.exe stuck on loading the WSL directory
  6. Open Windows Terminal to open a new WSL instance
  7. Notice WSL fail to load due to timeout error

Expected Behavior

Windows doesn't close Windows Terminal window and WSL should not be killed after sleep.
WSL should be recoverable in any case even if Windows kill the WSL process.

Actual Behavior

WSL can't be recovered after Windows kills it after sleep and a reboot is required.

Diagnostic Logs

No response

@OneBlue
Copy link
Collaborator

OneBlue commented Dec 13, 2022

/dumps

@ghost
Copy link

ghost commented Dec 13, 2022

Hello! Could you please provide logs and process dumps to help us better diagnose your issue?

To collect WSL logs and dumps, download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://github.com/raw/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1 -Dump

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging

Thank you!

@Ansuel
Copy link
Author

Ansuel commented Dec 13, 2022

@OneBlue hoping there is something useful... this dump is taken with the problem present...
By opening Windows Terminal the wsl shell never run and just stay like this with the cursor blinking
image

Since to repro this I have to make the pc sleep... will the dump command work in that case?
Here a wetransfer link for the dump... https://we.tl/t-iqYeBK1xAF (reached max upload size of 25mb)

@ghost ghost removed the needs-author-feedback label Dec 13, 2022
@kallja
Copy link

kallja commented Dec 15, 2022

I'm experiencing the same issue. I'm not sure if it happens every time the computer wakes from sleep or just most times, but this is definitely a problem.

WSL seems completely stuck. wsl.exe seems to hang indefinitely at most commands I've tried, including wsl --status. wsl --help completes successfully.

When the problem manifests, the Windows Subsystem for Linux service can not be stopped nor restarted from the Services GUI. Shutdown just pends indefinitely.

As a remedy to avoid reboot, killing the wslservice by running taskkill /F /pid <WSL_SERVICE_PID> in an administrative shell causes the service to recover and WSL to be usable once again.

@Ansuel
Copy link
Author

Ansuel commented Dec 15, 2022

@kallja do you have by chance docker desktop installed? What image are you using?
Do you have explorer window open in $wsl directory while the problem arise?

Wasn't aware of the taskkill procedure... That is useful for additional debug log. Nice!

(btw wsl --shutdown also stuck)

@Ansuel
Copy link
Author

Ansuel commented Dec 17, 2022

@OneBlue I finally found time to make a dump with the problem repro
here is the dump link https://we.tl/t-mTYroAcEj7

@Ansuel
Copy link
Author

Ansuel commented Dec 17, 2022

@kallja can confirm that by using the taskkill workaround wsl function is recovered. The bug can be repro by simply putting the pc to sleep back again...

@noamzbr
Copy link

noamzbr commented Dec 22, 2022

Having the exact same issue, except that taskkill /F /pid <WSL_SERVICE_PID> also doesn't work... Didn't find any fix so far apart from a full restart.

@Ansuel
Copy link
Author

Ansuel commented Dec 22, 2022

just open task manager details tab... find wslservice and kill... reopen the related wsl instance. Also can you provide info of running kernel, win build and other?

@noamzbr
Copy link

noamzbr commented Dec 22, 2022

Sorry just read your full description and realized I don't have the exact same issue. Other differences:

  1. Windows Terminal window doesn't close, is just stuck.
  2. vmmem process is running at 90%+ of cpu

Version

Windows: [10.0.19044 N/A Build 19044]

Kernel

5.15.79.1-microsoft-standard-WSL2

@Ansuel
Copy link
Author

Ansuel commented Dec 22, 2022

think you should open another issue

@JustThat70
Copy link

think you should open another issue

Perhaps not as they were just closed as being duplicates of this one even though they have somewhat different symptoms, and in my case, a different version of WSL

@JustThat70
Copy link

I've learned that if I perform a wsl --shutdown when I am done and before the PC goes to sleep or hibernates, that wsl will launch after waking

@Ansuel
Copy link
Author

Ansuel commented Dec 28, 2022

this wasn't the case before and wsl correctly worked after a sleep

@kallja
Copy link

kallja commented Jan 12, 2023

Sorry for the delay in answering.

@kallja do you have by chance docker desktop installed? What image are you using?

I do have Docker Desktop installed. When the computer wakes from sleep, WSL is dead whether there were running Docker containers or not. That doesn't seem to be a contributing factor.

Do you have explorer window open in $wsl directory while the problem arise?

No. Nowadays this happens pretty much always when my computer wakes from sleep.

@Ansuel
Copy link
Author

Ansuel commented Jan 13, 2023

Can confirm this is still present in latest dev build.

@pfz
Copy link

pfz commented Jan 13, 2023

I confirm that too. After hibernation S0/sleep/hybrid, whichever, gui killed, wsl still there but not responsive. wsl -d mydistro hangs forever. wsl --shutdown doesn't get stuck anymore all the time though. Getting logs that could have occured after wake is problematic, nothing there, and system wsl is not reachable either.

WSL version: 1.0.3.0
Kernel version: 5.15.79.1
WSLg version: 1.0.47
MSRDC version: 1.2.3575
Direct3D version: 1.606.4
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22623.1095

With debian and weston on for web dev, jetbrains gui running inside wsl.

@drummonds
Copy link

I have this problem as well and am wondering if it is to do with systemmd being turned on because I had problems with date time sync which gave me problems with hugo generating pages (as it thought they were in the future)

@runfaj
Copy link

runfaj commented Jun 22, 2023

Been having something kindof similar. Essentially the container is still running and I can still run commands and interact with it inside the container. However, any external commands (like docker desktop, any from vscode, etc) basically just die and never work. The ONLY way to fix is to completely shutdown WSL and restart it. This is definitely not ideal. It seems there is some intefacing bug with the running wsl instance that needs to be resolved.

Copy link
Contributor

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!

@msokolovsky-appulate
Copy link

hate this bug.

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.4651

workaround:


taskkill -IM "wslservice.exe" /F

# Stop the WSL2 service
Stop-Service -Name "LxssManager"

# Start the WSL2 service
Start-Service -Name "LxssManager"```

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

9 participants