WSL sometimes crashes when computer wakes from sleep
Version
Microsoft Windows [Version 10.0.19044.2364]
WSL Version
- [X] WSL 2
- [ ] WSL 1
Kernel Version
5.15.79.1-microsoft-standard-WSL2
Distro Version
Arch Linux
Other Software
No response
Repro Steps
- Open a terminal to the Linux instance
- Close laptop lid to put the computer to sleep
- Wait till the next day (or more precisely, as far as I can tell, until the computer has gone from sleep to hibernation)
- Start the computer again
- Find that the Linux instance has died.
Expected Behavior
I expect the Linux instance to also resume from sleep/hibernation without errors.
Actual Behavior
The Linux shell is unresponsive, and in the Windows Terminal, I see the following message:
[process exited with code 1 (0x00000001)]
I do not think this is a duplicate of #9301, because the Linux instance can easily be started again without rebooting the computer.
I have run the collect-wsl-logs.ps1 script and attached its output files as instructed (WslLogs-2023-01-30_16-39-46.zip), but its console output indicates that it wasn't entirely successful:
PS C:\Users\[username]> .\collect-wsl-logs.ps1
Directory: C:\Users\[username]
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 30/01/2023 16:39 WslLogs-2023-01-30_16-39-46
The operation completed successfully.
The operation completed successfully.
The operation completed successfully.
The operation completed successfully.
Log collection is running. Please reproduce the problem and press any key to save the logs.
Saving logs...
There are no trace profiles running.
Error code: 0xc5583000
Logs saved in: C:\Users\[username]\WslLogs-2023-01-30_16-39-46.zip. Please attach that file to the GitHub issue.
The part starting with "Saving logs..." is of course from after the computer has woken again. And I have run that script successfully before, so I guess that the error is related to WSL crashing.
I have also checked Event Viewer and found some log entries there which seem like they could be relevant. In chronological order:
- When I first put the computer in sleep mode:
- Info:
The driver \Driver\vpcivsp for device ROOT\VPCIVSP\0000 stopped the power transition. - Info:
The system is entering sleep. Sleep Reason: Button or Lid
- Info:
- When it later resumes to switch to hibernation:
- Info:
The driver \Driver\vpcivsp for device ROOT\VPCIVSP\0000 stopped the power transition. - Error:
The ms-resource:AppName service terminated unexpectedly. It has done this 2 time(s). - Info:
The system is entering sleep. Sleep Reason: Hibernate from Sleep - Fixed Timeout
- Info:
The Error message there caught my eye. In Services, I can see that ms-resource:AppName is actually C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.0.3.0_x64__8wekyb3d8bbwe\wslservice.exe. So I guess this means that the WSL service crashes.
Diagnostic Logs
No response
Thank you for reporting this @kyllingstad.
Can you follow the '11) Reporting a WSL process crash' section and share the wslservice.exe crash dump ?
I am trying to reproduce it with a crash dump and will report here as soon as I'm successful. It looks like the “sleep to hibernation” transition is not a sufficient condition to trigger the crash; it remains to see whether it’s a necessary one.
I'm experiencing the same problem after I updated wsl, as it prompted, several days ago. It occurred four or five times, mostly after awaking from hibernation. I'll try to see if I can reproduce it and collect the crash dump.
I'm a bit of worried about sending out dump files may leak private info.
I put the dump file into windbg. The output of !analyze -v looks like this:
KEY_VALUES_STRING: 1
Key : Analysis.CPU.mSec
Value: 546
Key : Analysis.DebugAnalysisManager
Value: Create
Key : Analysis.Elapsed.mSec
Value: 546
Key : Analysis.IO.Other.Mb
Value: 0
Key : Analysis.IO.Read.Mb
Value: 1
Key : Analysis.IO.Write.Mb
Value: 0
Key : Analysis.Init.CPU.mSec
Value: 686
Key : Analysis.Init.Elapsed.mSec
Value: 88990
Key : Analysis.Memory.CommitPeak.Mb
Value: 268
Key : Timeline.OS.Boot.DeltaSec
Value: 83015
Key : Timeline.Process.Start.DeltaSec
Value: 40319
Key : WER.OS.Branch
Value: vb_release
Key : WER.OS.Timestamp
Value: 2019-12-06T14:06:00Z
Key : WER.OS.Version
Value: 10.0.19041.1
Key : WER.Process.Version
Value: 10.0.10011.16384
FILE_IN_CAB: wslservice.exe.18472.dmp
NTGLOBALFLAG: 0
PROCESS_BAM_CURRENT_THROTTLED: 0
PROCESS_BAM_PREVIOUS_THROTTLED: 0
APPLICATION_VERIFIER_FLAGS: 0
EXCEPTION_RECORD: (.exr -1)
ExceptionAddress: 00007ffa35de2684 (ntdll!TppRaiseInvalidParameter+0x0000000000000048)
ExceptionCode: c000000d
ExceptionFlags: 00000000
NumberParameters: 0
PROCESS_NAME: wslservice.exe
ERROR_CODE: (NTSTATUS) 0xc000000d - <Unable to get error code text>
EXCEPTION_CODE_STR: c000000d
STACK_TEXT:
ntdll!TppRaiseInvalidParameter+0x48
ntdll!TppCallbackMayRunLongProlog+0x50b53
ntdll!TpCallbackMayRunLong+0x26
KERNELBASE!CallbackMayRunLong+0xb
IPHLPAPI!ThreadpoolWorkCallback+0x61
ntdll!TppWorkpExecuteCallback+0x130
ntdll!TppWorkerThread+0x68a
kernel32!BaseThreadInitThunk+0x14
ntdll!RtlUserThreadStart+0x21
STACK_COMMAND: ~5s; .ecxr ; kb
SYMBOL_NAME: iphlpapi!ThreadpoolWorkCallback+61
MODULE_NAME: IPHLPAPI
IMAGE_NAME: IPHLPAPI.DLL
FAILURE_BUCKET_ID: INVALID_PARAMETER_c000000d_IPHLPAPI.DLL!ThreadpoolWorkCallback
OS_VERSION: 10.0.19041.1
BUILDLAB_STR: vb_release
OSPLATFORM_TYPE: x64
OSNAME: Windows 10
IMAGE_VERSION: 10.0.19041.1865
FAILURE_ID_HASH: {2c04f593-4eb5-f690-42dc-82b4a67ffe1b}
Followup: MachineOwner
It seems this doesn't happen to me anymore. WSL used to crash every time I put my computer to sleep overnight, but now it doesn't anymore. Perhaps an update fixed it. (It's a work laptop, so I don't have full control over when updates get installed.) It's good that someone else could reproduce it.
This is happening for me regularly when my computer is left alone overnight. It's an intermittent fault, and sometimes it might go for a week or longer without issue.
I've only experienced this issue since updating WSL via wsl --update a month or so ago.
PS C:\WINDOWS\system32> wsl --version 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.19044.2486
So you mention that it takes a while for this issue to occur, and you believe that it happens when the laptop goes from sleep to hibernation. So if you close the laptop lid and open it back up right away this does not happen?
I am mainly asking, because I am encountering a similar issue, and for me it happens pretty much immediately. Maybe I have to wait until the fan stops spinning, but that's about it.
And I found this issue related to windows terminal (which I noticed also closed itself) https://github.com/microsoft/terminal/issues/12513
And the people in this thread encountered that for them, all apps installed through the Microsoft store close, when they close their laptops. WSL, Ubuntu and the Microsoft Terminal (Preview) are all store apps, so I tried it out and just opened every app that I had installed through the store (by going to "My Library" in the store). When I closed my laptop and opened it back up they were all gone.
From this other issue, it appears that the problem is getting internal attention from Microsoft, but from what I can tell there is no consistent way of fixing it at the moment.
I'm not sure if this is the same problem that you have, but I think it is at least similar in behavior.
I have enabled automatic crash dumps, like @OneBlue suggested and I got some files, they were all titled pwsh.exe.<something>. Notably, I do not have a Microsoft store version of powershell installed. And also the powershell instance inside vscode stays open. So my best guess is, that the store apps aren't registered as crashes (including the store app ubuntu inside the store app "windows terminal") but the unexpected closure of powershell due to windows terminal shutting down gets registered as a "true" crash, but is ultimately unrelated to the root issue.
I don't know if I could look at those dump files, vscode tells me they're in binary
So you mention that it takes a while for this issue to occur, and you believe that it happens when the laptop goes from sleep to hibernation. So if you close the laptop lid and open it back up right away this does not happen?
No, that hasn't happened to me.
[…]
And I found this issue related to windows terminal (which I noticed also closed itself) microsoft/terminal#12513
And the people in this thread encountered that for them, all apps installed through the Microsoft store close, when they close their laptops. WSL, Ubuntu and the Microsoft Terminal (Preview) are all store apps, so I tried it out and just opened every app that I had installed through the store (by going to "My Library" in the store). When I closed my laptop and opened it back up they were all gone.
This seems like a different issue. Windows Terminal never crashed for me, only WSL.
Ok, it seems this has little to do with hibernation. It just happened now when I woke the computer from regular sleep. I've updated the issue title accordingly. Like a previous poster, I also worry about publishing dump files, so here is my windbg output of !analyze -v:
KEY_VALUES_STRING: 1
Key : Analysis.CPU.mSec
Value: 906
Key : Analysis.DebugAnalysisManager
Value: Create
Key : Analysis.Elapsed.mSec
Value: 11490
Key : Analysis.IO.Other.Mb
Value: 0
Key : Analysis.IO.Read.Mb
Value: 0
Key : Analysis.IO.Write.Mb
Value: 32
Key : Analysis.Init.CPU.mSec
Value: 765
Key : Analysis.Init.Elapsed.mSec
Value: 48704
Key : Analysis.Memory.CommitPeak.Mb
Value: 89
Key : Timeline.OS.Boot.DeltaSec
Value: 85286
Key : Timeline.Process.Start.DeltaSec
Value: 85266
Key : WER.OS.Branch
Value: vb_release
Key : WER.OS.Timestamp
Value: 2019-12-06T14:06:00Z
Key : WER.OS.Version
Value: 10.0.19041.1
Key : WER.Process.Version
Value: 10.0.10011.16384
FILE_IN_CAB: wslservice.exe.6588.dmp
NTGLOBALFLAG: 0
PROCESS_BAM_CURRENT_THROTTLED: 0
PROCESS_BAM_PREVIOUS_THROTTLED: 0
APPLICATION_VERIFIER_FLAGS: 0
CONTEXT: (.ecxr)
rax=00007ff7c10a8af8 rbx=0000000000000000 rcx=000001cbe4a29940
rdx=0000000000000000 rsi=0000006cf1affc78 rdi=000001cbe4a6e680
rip=00007fff8e102684 rsp=0000006cf1aff8d0 rbp=000001cbe4a706a8
r8=0000000000000000 r9=0000000000000000 r10=0000000000000000
r11=0000000000000000 r12=000000007ffe03b0 r13=000000000000022c
r14=0000006cf1affa48 r15=0000006cf1affa20
iopl=0 nv up ei pl nz na pe nc
cs=0033 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000202
ntdll!TppRaiseInvalidParameter+0x48:
00007fff`8e102684 eb00 jmp ntdll!TppRaiseInvalidParameter+0x4a (00007fff`8e102686)
Resetting default scope
EXCEPTION_RECORD: (.exr -1)
ExceptionAddress: 00007fff8e102684 (ntdll!TppRaiseInvalidParameter+0x0000000000000048)
ExceptionCode: c000000d
ExceptionFlags: 00000000
NumberParameters: 0
PROCESS_NAME: wslservice.exe
ERROR_CODE: (NTSTATUS) 0xc000000d - An invalid parameter was passed to a service or function.
EXCEPTION_CODE_STR: c000000d
STACK_TEXT:
0000006c`f1aff8d0 00007fff`8e0b0b2b : 00000000`00000001 00007fff`8e0105dd 00000000`00000000 00006572`0d18d124 : ntdll!TppRaiseInvalidParameter+0x48
0000006c`f1aff9b0 00007fff`8e05ff96 : 00000000`0001000a 00000000`00000000 0000006c`f1affc78 00006572`0d18d024 : ntdll!TppCallbackMayRunLongProlog+0x50b53
0000006c`f1aff9f0 00007fff`8b9c376b : 00000000`00000000 00007fff`00000004 00000001`00000003 00006572`00000000 : ntdll!TpCallbackMayRunLong+0x26
0000006c`f1affa40 00007fff`8ab295d1 : 000001cb`e4a02340 00000000`00000000 00000000`00000000 0000006c`f1affc78 : KERNELBASE!CallbackMayRunLong+0xb
0000006c`f1affa70 00007fff`8e052260 : 000001cb`e4a705e0 00000000`00000001 000001cb`e53f6970 000001cb`e4a02340 : IPHLPAPI!ThreadpoolWorkCallback+0x61
0000006c`f1affab0 00007fff`8e0431aa : 000001cb`e4a1b5e8 00000000`00000000 000001cb`e4a02340 00000000`00000000 : ntdll!TppWorkpExecuteCallback+0x130
0000006c`f1affb00 00007fff`8d837614 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!TppWorkerThread+0x68a
0000006c`f1affe00 00007fff`8e0426a1 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : kernel32!BaseThreadInitThunk+0x14
0000006c`f1affe30 00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x21
STACK_COMMAND: ~8s; .ecxr ; kb
SYMBOL_NAME: iphlpapi!ThreadpoolWorkCallback+61
MODULE_NAME: IPHLPAPI
IMAGE_NAME: IPHLPAPI.DLL
FAILURE_BUCKET_ID: INVALID_PARAMETER_c000000d_IPHLPAPI.DLL!ThreadpoolWorkCallback
OS_VERSION: 10.0.19041.1
BUILDLAB_STR: vb_release
OSPLATFORM_TYPE: x64
OSNAME: Windows 10
IMAGE_VERSION: 10.0.19041.1865
FAILURE_ID_HASH: {2c04f593-4eb5-f690-42dc-82b4a67ffe1b}
Followup: MachineOwner
---------
I don't know if this is useful, so please advise on how I can send the dump file safely to Microsoft if needed.
Okay, if Windows terminal and other store apps, like the store itself, stay open this does seem to be different to my issue.
To send files to Microsoft you can use Feedback Hub:

And choose attach file there, not sure if there is a limitation to which file types can be attached.
It also happens with my wsl1/Ubuntu 22.04. After waking up from some kind of power-saving mode (I'm not sure whether it's sleep or hibernation). The Ubuntu shell would display the following error message:
Error: 0xd00002fe
Error code: Wsl/Service/0xd00002fe Press any key to continue...
When I press any key, the window for the shell would be gone.
Here is the version of the wsl:
WSL version: 1.1.3.0
Kernel version: 5.15.90.1
WSLg version: 1.0.49
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19042.2604
Although the version is supposed to run WSL2, my Windows' version is too old. WSL1 is in fact running. I had the problem after upgrading to the version that supports WSL2. (I don't benifit from the upgrade, but got the new problem.)
I wonder if downgrading the wsl version would help.
I have the same issue, and it is NOT related to hibernation, but to sleep mode. Happens consistently after I get out of sleep (sleep duration makes no difference), and I distinctly remember this has started after I "upgraded" haha to WSL2 from the store.
I'm using Windows terminal and VSCode and both apps are affected.
Terminal: [process exited with code 1 (0x00000001)]
I don't have to stop/start/restart WSL2 at this point. Its enough to open a new Ubuntu window in Terminal and continue working, so its not a workstopper but a major annoyance and time waster. This has been going on and on so many times for weeks now, that I was forced to search for a solution and found this thread.
> wsl -l -v
NAME STATE VERSION
* Ubuntu Running 2
> uname -r
5.15.90.1-microsoft-standard-WSL2
Ubuntu version: 20.04.5 LTS
WSL version: 1.1.3.0
Kernel version: 5.15.90.1
WSLg version: 1.0.49
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19044.2604
WSL1 is in fact running
@yubrshen I think you are on WSL2. https://askubuntu.com/questions/1177729/wsl-am-i-running-version-1-or-version-2
I distinctly remember this has started after I "upgraded" haha to WSL2 from the store.
Same here. I deleted the app and now WSL seems running OK. The problem was only present on my work laptop where modern standby is enabled.
@zoliweiss could you pls let me know how you reverted to "normal" WSL. Did you remove 1 or both of these under Settings > Apps & features?

Did you have to reinstall WSL after that? Or something else?
No, I removed the WSL app from the Start menu with right click remove option, if I remember correctly. I can't show you, because I already removed it.
Did you have to reinstall WSL after that? Or something else?
No, it just reverted to the old version I guess, because it now sometimes displays the update message in terminal.
OK thanks. Start menu item corresponds to "Windows Subsystem for Linux" under Apps & features. This - https://www.microsoft.com/store/productId/9P9TQF7MRM4R
So just to be sure: your Ubuntu installation didnt get affected in any way right? No files lost, everything running seamlessly like before?
I'll also uninstall and check for a few days and report back.
So just to be sure: your Ubuntu installation didnt get affected in any way right? No files lost, everything running seamlessly like before?
I didn't find any problem.
@zehawki thanks for reminding me that my Windows 10 can actually run WSL 2. Last time, after upgrading the wsl, I was led to believe that I could run WSL2. But the conversion of my Ubuntu to WSL 2 took forever, never-ending.
Today, I tried the conversion again. It worked much better.
First of all, when I execute the conversion command, I got an error in the PowerShell:
wsl --set-version Ubuntu-22.04 2
Importing the distribution failed. Error code: Wsl/Service/WSL_E_IMPORT_FAILED
Upon extensive search, eventually, MS new Bing told me that the top of the three reasons for the failure is the PowerShell lacked admin privilege. I then ran the same command with elevated privilege PowerShell. After nearly two hours, this time the conversion succeeded. Now, Ubuntu runs in WSL2! I can use WSLg without an external X server to run graphic emacs now.
(It looks like the recent another upgrade of wsl might have improved to my convention.)
I also had to stopped the running instance of Ubuntu before the conversion, by the command:
wsl -t Ubuntu-22.04
It turned out that the error message is exactly the same as appearing in the Ubuntu shell when my laptop wakes up from sleep!
I'll continue to monitor if the problem of Ubuntu stopping after waking up still happens.
I have a new finding on this - perhaps this issue is related to network, not sleep. Right now the same crash happened as soon as I turned off my VPN.
I can conjecture that the same happens upon wake from sleep - the VPN takes a short time to connect and that's when the crash is seen, and we think its due to a sleep issue. For people who don't have a VPN and see this issue, perhaps some other network change happens upon wake from sleep.
Edit 16/03/2023: this has happened now quite a few times (over multiple days) exactly after VPN turn off.
Next Ive uninstalled "Windows Subsystem for Linux", and now I get the message when starting WSL: Windows Subsystem for Linux is now available in the Microsoft Store! You can upgrade by running 'wsl.exe --update' or by visiting https://aka.ms/wslstorepage Installing WSL from the Microsoft Store will give you the latest WSL updates, faster. For more information please visit https://aka.ms/wslstoreinfo
WSL2 (including Windows Terminal) crashes every time Windows 11 wakes up from sleep. Same setup is working flawlessly on Windows 10.
I have a similar issue. the WSL process pauses when computer goes to sleep but does not resume. i have noticed that the clock of the WSL is paused at the time in the past when it paused and resumes from that time. i have noticed this behavior after work computer updated to Windows 11, version 22H2
On my side the issue has disappeared after uninstalling WSL2 store version (and reverting to "normal" WSL2) as advised by @zoliweiss.
It's really confusing why this is a non-issue for Microsoft. It basically renders WSL2 unusable for any serious work on Windows 11.
The issue is gone for me after the latest update [0]. WSL is not crashing anymore after sleep, though Windows Terminal sometimes does crash, but WSL is fine and responsive.
[0] 2023-03 Cumulative Update for Windows 11 Version 22H2 for x64-based Systems (KB5023706)
This is still a problem for me, WSL2 with Ubuntu - Crashes on wake from sleep and refused to be shutdown using wsl --terminate ubuntu the other issue is when it crashes it uses 99% of CPU until it eventually closes from the command mentioned or I restart the device.

This has been happening for the better part of a year.
Specs - WSL version: 1.2.0.0 Kernel version: 5.15.90.1 WSLg version: 1.0.51 MSRDC version: 1.2.3770 Direct3D version: 1.608.2-61064218 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22000.1817
Same here with WSL-Version: 1.2.5.0 Kernelversion: 5.15.90.1 WSLg-Version: 1.0.51 MSRDC-Version: 1.2.3770 Direct3D-Version: 1.608.2-61064218 DXCore-Version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows-Version: 10.0.19045.2846
Sometimes only taskkill /f /im wslservice.exe works to restart wsl2.
Having the same Problem with WSL2 and Ubuntu under Win10. After hibernation, the environment bekomes sluggish to the point of a crash with:
I cant even open a terminal and run htop to check whats using all those resources. Only restart of the host helps.
The same situation - WSL2:
I can reproduce on my machine
WSL version: 2.3.11.0
kernel version: 6.6.36.3-1
WSLg version: 1.0.63
MSRDC version: 1.2.5326
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.22631.3880