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

WSL2: wsl.exe hangs for 10s of minutes before working #11067

Closed
1 of 2 tasks
DanKaplanSES opened this issue Jan 24, 2024 · 11 comments
Closed
1 of 2 tasks

WSL2: wsl.exe hangs for 10s of minutes before working #11067

DanKaplanSES opened this issue Jan 24, 2024 · 11 comments

Comments

@DanKaplanSES
Copy link
Contributor

DanKaplanSES commented Jan 24, 2024

Windows Version

Microsoft Windows [Version 10.0.19045.3930]

WSL Version

2.0.14.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

I can't run wsl.exe --status right now because wsl is hanging

Distro Version

I can't run lsb_release -r right now because wsl is hanging

Other Software

wsltty, updated earlier today while experiencing this problem: https://github.com/mintty/wsltty/releases/tag/3.7.0.2

Repro Steps

Unfortunately I can't reproduce this consistently. After a fresh restart, wsl.exe / Ubuntu usually behave as expected, but after hours of uptime, wsl.exe hangs.

Normally I don't wait for it to finish: it can take up to 30 minutes before a wsl.exe command completes, and it doesn't always result in resolving the problem when it does complete. Sometimes it errors, sometimes wsl.exe starts an ubuntu prompt.

Expected Behavior

I would like wsl.exe to immediately respond with correct output. e.g., if I run wsl.exe --status, I would like to immediately see that response.

If wsl.exe can't be run for some reason, I would like it to fail fast instead of 30 minutes later. I've been waiting 20+ minutes for wsl.exe --status to complete as I write this up, but I will probably restart my computer before it finishes because it is blocking my ability to work.

Actual Behavior

Occasionally, any wsl.exe command will hang for 10s of minutes before showing any output.

Diagnostic Logs

  1. WslLogs-2024-01-23_15-16-07.zip These first logs prompted me to create this issue. I ran wsl in an administrator cmd.exe and it took a very long time to complete. I captured the log while it was hanging and then noticed it completed. This seemed unique enough to share, as I haven't noticed other issues saying it worked eventually after waiting long enough: it opened up a wsl command prompt (2nd line of screenshot).

    image

    The first line occurred after I manually killed the wsl service in the task manager (shown in this screenshot) then ran wsl:

    image

    Eventually it errored with Server execution failed\nError code: Wsl/0x80080005. I tried again and it hung for 10+ minutes, but then it opened up the wsl command prompt. All of the other commands worked immediately except for the very last line (i.e., wsl.exe --status). I'm still waiting on that one and it feels like it's been ~45 minutes at this point.

  2. WslLogs-2024-01-23_15-28-12.zip The second logs were generated when I ran wsl.exe --status and it was hanging 1-20 minutes when I collected those logs (sorry I'm not timing it exactly).

  3. Just in case it may help, WslLogs-2024-01-23_16-04-16.zip these logs are of the same hanging wsl.exe --status command. This one is around 20-45 minutes since it started.

  4. wsl.exe --version:

    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.19045.3930
    
  5. I'm not sure if this should be running in the latest WSL2 versions, but whenever these symptoms occur, I've noticed that the vmmem process is no longer running in the task manager.

  6. I'm sure there's way too much information in here as it is, but I decided to thoroughly document a similar troubleshooting experience I had a few weeks ago. Perhaps it'll provide some useful information: https://superuser.com/questions/1825580/how-do-i-troubleshoot-an-unresponsive-wsl2-on-windows-10

After system restart 1 of n

wsl was working fine for ~20 minutes, but now everything is hanging like before. Here's a fresh log:
WslLogs-2024-01-23_17-56-57.zip

After system restart 2 of n

I can get some of this information now.

Kernel Version

Default Distribution: Ubuntu
Default Version: 2

Distro Version

No LSB modules are available.
Release:        24.04
Copy link

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@DanKaplanSES
Copy link
Contributor Author

DanKaplanSES commented Jan 24, 2024

My wsl.exe --status is still hanging. I think this means I've experienced two separate issues here:

  1. Log 1 is the system being slow to respond
  2. Logs >= 2 is wsl stuck indefinitely.

And just to provide as much helpful information as I can, I'm going to create yet another WSL log right before I restart:
WslLogs-2024-01-23_17-04-47.zip

It might help to show the times in which I created these logs:

image


re: the bot's links

As far as I can tell those issues weren't exactly the same as mine. This one appears to have the most helpful information, mainly the second half of the comments: #4144 I use the word "appears" because I tried one and it didn't fix the problem:

I looked into my services.msc and saw that LxssManager was stuck in a "Stopping" state.

image

After I killed it, I opened a new wsltty terminal and it's hanging like before. I don't plan to stick around long enough to see if it eventually finishes; I'm going to restart my computer now.

@DanKaplanSES
Copy link
Contributor Author

I tried the other major suggestion from #4144

Managed to fix the issue by disabling all WSL related features, rebooting, then enabling them again and rebooting once more. Later I had to run wsl --set-default-version 2 again.

Disabled Hyper-V plus WSL -> reboot -> enable them again -> reboot solved my issue!

It did not fix the issue.


I ran sfc and dsim (sp?). The former found nothing. The latter found something and fixed it, but it did not fix the issue, even after restart.

@DanKaplanSES
Copy link
Contributor Author

DanKaplanSES commented Jan 25, 2024

Okay I decided to wsl --export and reinstall everything with these steps: https://gist.github.com/4wk-/889b26043f519259ab60386ca13ba91b

Everything was working fine with my new install. Then, I these last two steps, then the permanent hanging issue immediately came back:

1.

I modified my /etc/wsl.conf to change the user back to what it was (See https://learn.microsoft.com/en-us/windows/wsl/basic-commands#change-the-default-user-for-a-distribution )

2.

wsl --update.

It was this:

PS C:\Windows\system32> wsl --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.19045.3996

It became this:

PS C:\Windows\system32> wsl --version
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.19045.3996

Now I'm stuck at
PS C:\Windows\system32> wsl

WslLogs-2024-01-24_23-28-12.zip


It might be worth noting vmmem is running in the task manager again.


Without reinstalling WSL, I killed WSL in the task manager, unregistered my imported distro, reimported it, set the user to the original value. I'll report back if it happens yet again.

If it does happen again, next I'll try reinstalling WSL without running wsl --upgrade.


It seemed to be working all right until I noticed vmmem was using 1.5 gigs, so I ran wsl --shutdown. This command hung indefinitely. I don't know what's stopping it from completing because I don't see anything in my services.msc that are trying to stop and I don't see wsl mentioned in my task manager.

Guess I'll reinstall everything from scratch again.

@DanKaplanSES
Copy link
Contributor Author

okay I followed these steps again but skipped the wsl --upgrade step. I added one additional variable this time: I turned off the hyper-v feature and restarted and turned it back on again and restarted.

So far so good. Up to this point I could reproduce these problems in one tenth of the time and in one tenth of the attempts to trigger it. wsl --shutdown ran and completed instantly, too.

I'm willing to run wsl --upgrade to remove that last variable, but hopefully the log files have given enough information to troubleshoot.

@OneBlue
Copy link
Collaborator

OneBlue commented Jan 30, 2024

/dumps

@DanKaplanSES
Copy link
Contributor Author

DanKaplanSES commented Jan 30, 2024

@OneBlue I've attached six log files throughout this thread. You can find them by searching for ".zip" in your browser. Let me know if they are missing information. Thanks

@DanKaplanSES
Copy link
Contributor Author

@OneBlue Hope you don't mind the second ping so soon. Let me know how else I can help, because I think I'm in a good position to do so!

@OneBlue
Copy link
Collaborator

OneBlue commented Mar 13, 2024

@DanKaplanSES: I'm not seeing any dumps in the zip files, I think given that the symptoms what we need is a dump of the WSL processes while things are 'stuck'. /dumps

Copy link
Contributor

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://raw.githubusercontent.com/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!

Copy link
Contributor

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

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants