Open wisemanny opened 1 year ago
In Event Viewere I see such log events:
Application: pwsh.exe
CoreCLR Version: 7.0.22.51805
.NET Version: 7.0.0
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidOperationException: Cannot read keys when either application does not have a console or when console input has been redirected. Try Console.Read.
at System.ConsolePal.ReadKey(Boolean intercept)
at Microsoft.PowerShell.Internal.VirtualTerminal.ReadKey()
at Microsoft.PowerShell.PSConsoleReadLine.ReadOneOrMoreKeys()
at Microsoft.PowerShell.PSConsoleReadLine.ReadKeyThreadProc()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
and
Faulting application name: pwsh.exe, version: 7.3.0.500, time stamp: 0x634eda42
Faulting module name: Microsoft.PowerShell.ConsoleHost.dll, version: 7.3.0.500, time stamp: 0xa3a9c435
Exception code: 0x80131623
Fault offset: 0x000000000004de7b
Faulting process id: 0x0x1E08
Faulting application start time: 0x0x1D90A2ACCE8B73D
Faulting application path: C:\Program Files\PowerShell\7\pwsh.exe
Faulting module path: C:\Program Files\PowerShell\7\Microsoft.PowerShell.ConsoleHost.dll
Report Id: 5e2b0c3e-cc6d-4c2a-b974-66fcc4c47110
Faulting package full name:
Faulting package-relative application ID:
Sometimes such error:
Application: pwsh.exe
CoreCLR Version: 7.0.22.51805
.NET Version: 7.0.0
Description: The application requested process termination through System.Environment.FailFast.
Message: The Win32 internal error "No process is on the other end of the pipe." 0xE9 occurred while getting console output buffer information. Contact Microsoft Customer Support Services.
Description: The process was terminated due to an unhandled exception.System.Management.Automation.Host.HostException: The Win32 internal error "No process is on the other end of the pipe." 0xE9 occurred while getting console output buffer information. Contact Microsoft Customer Support Services.
---> System.ComponentModel.Win32Exception (233): No process is on the other end of the pipe.
--- End of inner exception stack trace ---
at Microsoft.PowerShell.ConsoleControl.GetConsoleScreenBufferInfo(SafeFileHandle consoleHandle)
at Microsoft.PowerShell.ConsoleHostRawUserInterface.get_CursorPosition()
at Microsoft.PowerShell.ConsoleHost.InputLoop.Run(Boolean inputLoopIsNested)
at Microsoft.PowerShell.ConsoleHost.InputLoop.RunNewInputLoop(ConsoleHost parent, Boolean isNested)
at Microsoft.PowerShell.ConsoleHost.EnterNestedPrompt()
at Microsoft.PowerShell.ConsoleHost.DoRunspaceLoop(String initialCommand, Boolean skipProfiles, Collection`1 initialCommandArgs, Boolean staMode, String configurationName, String configurationFilePath)
at Microsoft.PowerShell.ConsoleHost.Run(CommandLineParameterParser cpp, Boolean isPrestartWarned)
at Microsoft.PowerShell.ConsoleHost.Start(String bannerText, String helpText, Boolean issProvidedExternally)
at Microsoft.PowerShell.UnmanagedPSEntry.Start(String[] args, Int32 argc)
Stack:
at System.Environment.FailFast(System.String, System.Exception)
at Microsoft.PowerShell.UnmanagedPSEntry.Start(System.String[], Int32)
at Microsoft.PowerShell.ManagedPSEntry.Main(System.String[])
I see crash dumps:
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 12/6/2022 2:21 PM 6728840 pwsh.exe.12880.dmp
-a--- 12/6/2022 2:21 PM 7108647 pwsh.exe.14556.dmp
-a--- 12/5/2022 5:48 PM 6921187 pwsh.exe.17304.dmp
-a--- 12/5/2022 5:48 PM 7264709 pwsh.exe.19560.dmp
-a--- 12/7/2022 9:40 AM 6484570 pwsh.exe.21780.dmp
-a--- 12/6/2022 8:29 PM 6904897 pwsh.exe.5368.dmp
-a--- 12/5/2022 8:35 PM 6699049 pwsh.exe.6360.dmp
-a--- 12/5/2022 5:48 PM 6735171 pwsh.exe.6592.dmp
-a--- 12/7/2022 5:03 PM 6949380 pwsh.exe.7688.dmp
-a--- 12/5/2022 7:31 PM 7017435 pwsh.exe.9936.dmp
dotnet-dump shows such stacktrace:
> clrstack -all
OS Thread Id: 0x1c8c
Child SP IP Call Site
000000316EF7E0E8 00007ff9de00f954 [HelperMethodFrame: 000000316ef7e0e8] System.Threading.WaitHandle.WaitOneCore(IntPtr, Int32)
000000316EF7E1F0 00007FF91F9A3908 System.Threading.WaitHandle.WaitOneNoCheck(Int32) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/WaitHandle.cs @ 120]
000000316EF7E250 00007FF97C8EA146 System.Management.Automation.Runspaces.PipelineBase.Invoke(System.Collections.IEnumerable)
000000316EF7E290 00007FF97C9F90E6 System.Management.Automation.PowerShell+Worker.ConstructPipelineAndDoWork(System.Management.Automation.Runspaces.Runspace, Boolean)
000000316EF7E360 00007FF97C9F8BE4 System.Management.Automation.PowerShell+Worker.CreateRunspaceIfNeededAndDoWork(System.Management.Automation.Runspaces.Runspace, Boolean)
000000316EF7E3D0 00007FF97CBC829C System.Management.Automation.PowerShell.CoreInvokeHelper[[System.__Canon, System.Private.CoreLib],[System.__Canon, System.Private.CoreLib]](System.Management.Automation.PSDataCollection`1<System.__Canon>, System.Management.Automation.PSDataCollection`1<System.__Canon>, System.Management.Automation.PSInvocationSettings)
000000316EF7E450 00007FF97CBC8705 System.Management.Automation.PowerShell.CoreInvoke[[System.__Canon, System.Private.CoreLib],[System.__Canon, System.Private.CoreLib]](System.Management.Automation.PSDataCollection`1<System.__Canon>, System.Management.Automation.PSDataCollection`1<System.__Canon>, System.Management.Automation.PSInvocationSettings)
000000316EF7E4D0 00007FF97C74BD85 System.Management.Automation.PowerShell.Invoke(System.Collections.IEnumerable, System.Management.Automation.PSInvocationSettings)
000000316EF7E530 00007FF988B4955F Microsoft.PowerShell.ConsoleHostUserInterface.TryInvokeUserDefinedReadLine(System.String ByRef)
000000316EF7E580 00007FF988B48CB7 Microsoft.PowerShell.ConsoleHostUserInterface.ReadLineWithTabCompletion(Microsoft.PowerShell.Executor)
000000316EF7E6B0 00007FF988B530D9 Microsoft.PowerShell.ConsoleHost+InputLoop.Run(Boolean)
000000316EF7E760 00007FF988B52C73 Microsoft.PowerShell.ConsoleHost+InputLoop.RunNewInputLoop(Microsoft.PowerShell.ConsoleHost, Boolean)
000000316EF7E7B0 00007FF988B40655 Microsoft.PowerShell.ConsoleHost.EnterNestedPrompt()
000000316EF7E810 00007FF988B415FE Microsoft.PowerShell.ConsoleHost.DoRunspaceLoop(System.String, Boolean, System.Collections.ObjectModel.Collection`1<System.Management.Automation.Runspaces.CommandParameter>, Boolean, System.String, System.String)
000000316EF7E8B0 00007FF988B414D2 Microsoft.PowerShell.ConsoleHost.Run(Microsoft.PowerShell.CommandLineParameterParser, Boolean)
000000316EF7E920 00007FF988B3F745 Microsoft.PowerShell.ConsoleHost.Start(System.String, System.String, Boolean)
000000316EF7E990 00007FF988B4DDB1 Microsoft.PowerShell.UnmanagedPSEntry.Start(System.String[], Int32)
000000316EF7E9F0 00007FF99AE6110D Microsoft.PowerShell.ManagedPSEntry.Main(System.String[])
OS Thread Id: 0x39ec
Child SP IP Call Site
000000316F87FD20 00007ff9de00f954 [DebuggerU2MCatchHandlerFrame: 000000316f87fd20]
OS Thread Id: 0x278
Child SP IP Call Site
000000316FBBF628 00007ff9de00f954 [HelperMethodFrame: 000000316fbbf628] System.Threading.WaitHandle.WaitOneCore(IntPtr, Int32)
000000316FBBF730 00007FF91F9A3908 System.Threading.WaitHandle.WaitOneNoCheck(Int32) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/WaitHandle.cs @ 120]
000000316FBBF790 00007FF97D9FC289 System.Threading.PortableThreadPool+GateThread.GateThreadStart() [/_/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.GateThread.cs @ 48]
000000316FBBFAC0 00007ff97e35e423 [DebuggerU2MCatchHandlerFrame: 000000316fbbfac0]
OS Thread Id: 0x2d14
Child SP IP Call Site
000000317033F5A8 00007ff9de00f954 [HelperMethodFrame: 000000317033f5a8] System.Threading.WaitHandle.WaitOneCore(IntPtr, Int32)
000000317033F6B0 00007FF91F9A3908 System.Threading.WaitHandle.WaitOneNoCheck(Int32) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/WaitHandle.cs @ 120]
000000317033F710 00007FF97D9F7FE2 System.Threading.TimerQueue.TimerThread() [/_/src/libraries/System.Private.CoreLib/src/System/Threading/TimerQueue.Portable.cs @ 92]
000000317033F9F0 00007ff97e35e423 [DebuggerU2MCatchHandlerFrame: 000000317033f9f0]
OS Thread Id: 0x13bc
Child SP IP Call Site
000000317063F928 00007ff9de00f954 [HelperMethodFrame: 000000317063f928] System.Threading.WaitHandle.WaitOneCore(IntPtr, Int32)
000000317063FA30 00007FF91F9A3908 System.Threading.WaitHandle.WaitOneNoCheck(Int32) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/WaitHandle.cs @ 120]
000000317063FA90 00007FF97A4826D1 Microsoft.ApplicationInsights.Channel.InMemoryTransmitter.Runner()
000000317063FB00 00007FF97D9EC878 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs @ 183]
000000317063FB70 00007FF97DA043C4 System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs @ 2345]
000000317063FE60 00007ff97e35e423 [DebuggerU2MCatchHandlerFrame: 000000317063fe60]
OS Thread Id: 0x40d4
Child SP IP Call Site
000000317067FB20 00007ff9de011d94 [InlinedCallFrame: 000000317067fb20]
000000317067FB20 00007ff97d9fe040 [InlinedCallFrame: 000000317067fb20]
000000317067FAE0 00007FF97D9FE040 System.Threading.PortableThreadPool+IOCompletionPoller.Poll() [/_/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.IO.Windows.cs @ 188]
000000317067FE40 00007ff97e35e423 [DebuggerU2MCatchHandlerFrame: 000000317067fe40]
OS Thread Id: 0x59c8
Child SP IP Call Site
00000031707FF368 00007ff9de00f954 [HelperMethodFrame_1OBJ: 00000031707ff368] System.Threading.Monitor.ObjWait(Int32, System.Object)
00000031707FF490 00007FF97D9EE9C9 System.Threading.ManualResetEventSlim.Wait(Int32, System.Threading.CancellationToken) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs @ 575]
00000031707FF530 00007FF97DA050FD System.Threading.Tasks.Task.SpinThenBlockingWait(Int32, System.Threading.CancellationToken) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs @ 3021]
00000031707FF5B0 00007FF97DA04EF2 System.Threading.Tasks.Task.InternalWaitCore(Int32, System.Threading.CancellationToken) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs @ 2956]
00000031707FF630 00007FF97DA58DB2 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) [/_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs @ 140]
00000031707FF660 00007FF97A25E4D0 System.IO.Pipes.NamedPipeServerStream.WaitForConnection() [/_/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Windows.cs @ 171]
00000031707FF6B0 00007FF97C8847BB System.Management.Automation.Remoting.RemoteSessionNamedPipeServer.ProcessListeningThread(System.Object)
00000031707FF810 00007FF97D9EC878 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs @ 183]
00000031707FFAD0 00007ff97e35e423 [DebuggerU2MCatchHandlerFrame: 00000031707ffad0]
OS Thread Id: 0x57cc
Child SP IP Call Site
00000031710FF308 00007ff9de00f484 [HelperMethodFrame: 00000031710ff308] System.Threading.Thread.SleepInternal(Int32)
00000031710FF400 00007FF91FFA14B5 System.Threading.Thread.Sleep(Int32) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs @ 372]
00000031710FF440 00007FF97A453DBC Microsoft.ApplicationInsights.Metrics.DefaultAggregationPeriodCycle.Run()
00000031710FF4D0 00007FF97D9EC878 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs @ 183]
00000031710FF790 00007ff97e35e423 [DebuggerU2MCatchHandlerFrame: 00000031710ff790]
OS Thread Id: 0x4470
Child SP IP Call Site
0000003171A8EE78 00007ff9db97acf4 [HelperMethodFrame: 0000003171a8ee78] System.Threading.WaitHandle.WaitMultipleIgnoringSyncContext(IntPtr*, Int32, Boolean, Int32)
0000003171A8EFA0 00007FF91FFE0BD6 System.Threading.WaitHandle.WaitMultiple(System.ReadOnlySpan`1<System.Threading.WaitHandle>, Boolean, Int32) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/WaitHandle.cs @ 250]
0000003171A8F070 00007FF91FFE2680 Microsoft.PowerShell.PSConsoleReadLine.ReadKey()
0000003171A8F220 00007FF91F970E24 Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
0000003171A8F2E0 00007FF91F96C5D1 Microsoft.PowerShell.PSConsoleReadLine.ReadLine(System.Management.Automation.Runspaces.Runspace, System.Management.Automation.EngineIntrinsics, System.Threading.CancellationToken, System.Nullable`1<Boolean>)
0000003171A8F3C0 00007FF91FC5D7B8 SOS Warning: Loading symbols for dynamic assemblies is not yet supported
<unknown>
0000003171A8F450 00007FF97CB845F7 System.Management.Automation.Interpreter.DynamicInstruction`5[[System.__Canon, System.Private.CoreLib],[System.__Canon, System.Private.CoreLib],[System.__Canon, System.Private.CoreLib],[System.__Canon, System.Private.CoreLib],[System.__Canon, System.Private.CoreLib]].Run(System.Management.Automation.Interpreter.InterpretedFrame)
0000003171A8F500 00007FF91FFD53CA System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(System.Management.Automation.Interpreter.InterpretedFrame)
0000003171A8F5A0 00007FF91FFD53CA System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(System.Management.Automation.Interpreter.InterpretedFrame)
0000003171A8F640 00007FF92001C1A8 System.Management.Automation.Interpreter.Interpreter.Run(System.Management.Automation.Interpreter.InterpretedFrame)
0000003171A8F6B0 00007FF92001BCA0 System.Management.Automation.Interpreter.LightLambda.RunVoid1[[System.__Canon, System.Private.CoreLib]](System.__Canon)
0000003171A8F730 00007FF97C7EDAD0 System.Management.Automation.DlrScriptCommandProcessor.RunClause(System.Action`1<System.Management.Automation.Language.FunctionContext>, System.Object, System.Object)
0000003171A8F7D0 00007FF97C7ED462 System.Management.Automation.DlrScriptCommandProcessor.Complete()
0000003171A8F850 00007FF9200180F3 System.Management.Automation.CommandProcessorBase.DoComplete()
0000003171A8F8A0 00007FF920180F92 System.Management.Automation.Internal.PipelineProcessor.DoCompleteCore(System.Management.Automation.CommandProcessorBase)
0000003171A8F970 00007FF9201800E9 System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(System.Object)
0000003171A8F9E0 00007FF91E8839E2 System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper()
0000003171A8FAC0 00007FF97C8E7A47 System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc()
0000003171A8FB20 00007FF97C8E8C0F System.Management.Automation.Runspaces.PipelineThread.WorkerProc()
0000003171A8FB50 00007FF97D9EC878 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs @ 183]
0000003171A8FE10 00007ff97e35e423 [DebuggerU2MCatchHandlerFrame: 0000003171a8fe10]
OS Thread Id: 0x5568
Child SP IP Call Site
000000317208F478 00007ff9de00f954 [HelperMethodFrame: 000000317208f478]
000000317208F570 00007FF91F9AB9B9 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [/_/src/libraries/System.Private.CoreLib/src/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs @ 53]
000000317208F5A0 00007FF97D9EC8F2 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs @ 207]
000000317208F860 00007ff97e35e423 [DebuggerU2MCatchHandlerFrame: 000000317208f860]
OS Thread Id: 0x21e8
Child SP IP Call Site
000000316F0FF328 00007ff9de00ef24 [InlinedCallFrame: 000000316f0ff328] Interop+Kernel32.<GetQueuedCompletionStatus>g____PInvoke|50_0(IntPtr, UInt32*, UIntPtr*, IntPtr*, Int32)
000000316F0FF328 00007ff91f9a67ee [InlinedCallFrame: 000000316f0ff328] Interop+Kernel32.<GetQueuedCompletionStatus>g____PInvoke|50_0(IntPtr, UInt32*, UIntPtr*, IntPtr*, Int32)
000000316F0FF2F0 00007FF91F9A67EE System.Threading.LowLevelLifoSemaphore.WaitForSignal(Int32) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/LowLevelLifoSemaphore.cs @ 200]
000000316F0FF3D0 00007FF91F9A355F System.Threading.LowLevelLifoSemaphore.Wait(Int32, Boolean) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/LowLevelLifoSemaphore.cs @ 44]
000000316F0FF490 00007FF97D9FEEF2 System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart() [/_/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.WorkerThread.cs @ 71]
000000316F0FF7F0 00007ff97e35e423 [DebuggerU2MCatchHandlerFrame: 000000316f0ff7f0]
OS Thread Id: 0x14fc
Child SP IP Call Site
000000316F9FF2D8 00007ff9de00ef24 [InlinedCallFrame: 000000316f9ff2d8] Interop+Kernel32.<GetQueuedCompletionStatus>g____PInvoke|50_0(IntPtr, UInt32*, UIntPtr*, IntPtr*, Int32)
000000316F9FF2D8 00007ff91f9a67ee [InlinedCallFrame: 000000316f9ff2d8] Interop+Kernel32.<GetQueuedCompletionStatus>g____PInvoke|50_0(IntPtr, UInt32*, UIntPtr*, IntPtr*, Int32)
000000316F9FF2A0 00007FF91F9A67EE System.Threading.LowLevelLifoSemaphore.WaitForSignal(Int32) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/LowLevelLifoSemaphore.cs @ 200]
000000316F9FF380 00007FF91F9A355F System.Threading.LowLevelLifoSemaphore.Wait(Int32, Boolean) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/LowLevelLifoSemaphore.cs @ 44]
000000316F9FF440 00007FF97D9FEEF2 System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart() [/_/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.WorkerThread.cs @ 71]
000000316F9FF7A0 00007ff97e35e423 [DebuggerU2MCatchHandlerFrame: 000000316f9ff7a0]
OS Thread Id: 0x5c54
Child SP IP Call Site
000000316FB7FDA0 00007ff9de00ee84 [DebuggerU2MCatchHandlerFrame: 000000316fb7fda0]
>
After I removed PSReadLine module the pwsh did not crash (yet).
Windows Terminal is opened all the time, for several days or weeks, until Windows restarts after updates. Usually there are several tabs opened.
wt 1.16.2642.0
> $PSVersionTable
Name Value
---- -----
PSVersion 7.3.0
PSEdition Core
GitCommitId 7.3.0
OS Microsoft Windows 10.0.22621
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
> (Get-Module PSReadLine).Version.ToString()
2.2.6
Mine just crashed again with no PSReadLine.
It is interesting that I have Alacritty window open with the same pwsh and it does not crash. So maybe the issue is in OpenConsole.exe but I see no crashdump even though I configured it in win registry.
Application: pwsh.exe
CoreCLR Version: 7.0.22.51805
.NET Version: 7.0.0
Description: The application requested process termination through System.Environment.FailFast.
Message: The Win32 internal error "No process is on the other end of the pipe." 0xE9 occurred while getting console output buffer information. Contact Microsoft Customer Support Services.
Description: The process was terminated due to an unhandled exception.System.Management.Automation.Host.HostException: The Win32 internal error "No process is on the other end of the pipe." 0xE9 occurred while getting console output buffer information. Contact Microsoft Customer Support Services.
---> System.ComponentModel.Win32Exception (233): No process is on the other end of the pipe.
--- End of inner exception stack trace ---
at Microsoft.PowerShell.ConsoleControl.GetConsoleScreenBufferInfo(SafeFileHandle consoleHandle)
at Microsoft.PowerShell.ConsoleHostRawUserInterface.get_CursorPosition()
at Microsoft.PowerShell.ConsoleHost.InputLoop.Run(Boolean inputLoopIsNested)
at Microsoft.PowerShell.ConsoleHost.InputLoop.RunNewInputLoop(ConsoleHost parent, Boolean isNested)
at Microsoft.PowerShell.ConsoleHost.EnterNestedPrompt()
at Microsoft.PowerShell.ConsoleHost.DoRunspaceLoop(String initialCommand, Boolean skipProfiles, Collection`1 initialCommandArgs, Boolean staMode, String configurationName, String configurationFilePath)
at Microsoft.PowerShell.ConsoleHost.Run(CommandLineParameterParser cpp, Boolean isPrestartWarned)
at Microsoft.PowerShell.ConsoleHost.Start(String bannerText, String helpText, Boolean issProvidedExternally)
at Microsoft.PowerShell.UnmanagedPSEntry.Start(String[] args, Int32 argc)
Stack:
at System.Environment.FailFast(System.String, System.Exception)
at Microsoft.PowerShell.UnmanagedPSEntry.Start(System.String[], Int32)
at Microsoft.PowerShell.ManagedPSEntry.Main(System.String[])
It is interesting that I have Alacritty window open with the same pwsh and it does not crash. So maybe the issue is in OpenConsole.exe but I see no crashdump even though I configured it in win registry.
Hard to say. I doubt it's a terminal problem, but it could be. Try to install PSReadline for user:
Install-Module PSReadline -Scope CurrentUser -Force
This module will be loaded instead of the general one. And I installed the pwsh from the msi package, not from the Microsoft Store.
The stack here looks very similar to https://github.com/PowerShell/PowerShell/issues/16818, though, that issue does seem to specifically reference the alt buffer[1].
~If you set "closeOnExit": "never"
for the profile, does the Terminal stick around? I wonder if this is pwsh
crashing, and the Terminal closing as a result, or the other way around. That setting might help ID~ er, no, that's probably not relevant. If there's a pwsh
tab and a cmd
tab that both exit, then that's probably something Terminal-side that's causing the app to exit. This makes me thing of https://github.com/microsoft/terminal/issues/14436#issuecomment-1337476068, where there was a XAML stowed exception taking the Terminal down, but not in a way that created a windowsterminal.exe dump (for whatever reason).
I might be able to track a /feedback hub submission back to an unrelated crash from your machine. It's worth a shot.
@stevel-msft any ideas here?
[1]: Interestingly, I think when that pwsh issue had been originally authored, the Terminal didn't support the alt buffer yet.
Hi there!
Can you please send us feedback with the Feedback Hub with this issue? Make sure to click the "Start recording" button, then reproduce the issue before submitting the feedback. Once it's submitted, paste the link here so we can more easily find your crash information on the back end?
Thanks!
Now I have WT's crash dump. Let me know where I can post it. Some of the details are:
0:000> kp
# Child-SP RetAddr Call Site
00 (Inline Function) --------`-------- Windows_UI_Xaml!CDependencyObject::GetDXamlPeer(void) [onecoreuap\windows\dxaml\xcp\core\inc\CDependencyObject.h @ 1527]
01 0000001d`68d8e060 00007ffb`736d4b1e Windows_UI_Xaml!DirectUI::ToolTipService::EnsureHandlersAttachedToRootElement(class VisualTree * visualTree = 0x0000001d`68d8d7f0)+0x21 [onecoreuap\windows\dxaml\xcp\dxaml\lib\tooltipservice_partial.cpp @ 802]
02 0000001d`68d8e0b0 00007ffb`736d44f2 Windows_UI_Xaml!DirectUI::ToolTip::OpenPopup(void)+0x156 [onecoreuap\windows\dxaml\xcp\dxaml\lib\tooltip_partial.cpp @ 747]
03 0000001d`68d8e140 00007ffb`72f2407e Windows_UI_Xaml!DirectUI::ToolTip::OnIsOpenChanged(unsigned char bIsOpen = <Value unavailable error>)+0x51e [onecoreuap\windows\dxaml\xcp\dxaml\lib\tooltip_partial.cpp @ 517]
04 0000001d`68d8e1a0 00007ffb`72ba06a2 Windows_UI_Xaml!DirectUI::ToolTip::OnPropertyChanged2+0x221ffe [onecoreuap\windows\dxaml\xcp\dxaml\lib\tooltip_partial.cpp @ 352]
05 0000001d`68d8e1d0 00007ffb`72bb071f Windows_UI_Xaml!DirectUI::DependencyObject::NotifyPropertyChanged(struct PropertyChangedParams * args = 0x0000001d`68d8e2e8)+0x72 [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 2342]
06 (Inline Function) --------`-------- Windows_UI_Xaml!DirectUI::DependencyObject::NotifyPropertyChanged(void)+0x91 [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 2763]
07 (Inline Function) --------`-------- Windows_UI_Xaml!CFxCallbacks::DependencyObject_NotifyPropertyChanged(void)+0x91 [onecoreuap\windows\dxaml\xcp\dxaml\lib\fxcallbacks.cpp @ 699]
08 (Inline Function) --------`-------- Windows_UI_Xaml!CDependencyObject::NotifyPropertyChanged(void)+0xcf [onecoreuap\windows\dxaml\xcp\core\core\elements\depends.cpp @ 2834]
09 0000001d`68d8e280 00007ffb`72bae8ef Windows_UI_Xaml!CDependencyObject::SetEffectiveValue(struct CDependencyObject::EffectiveValueParams * args = 0x0000001d`68d8e420)+0x47f [onecoreuap\windows\dxaml\xcp\components\dependencyobject\propertysystem.cpp @ 1698]
0a 0000001d`68d8e3c0 00007ffb`72bae74b Windows_UI_Xaml!CDependencyObject::UpdateEffectiveValue(struct CDependencyObject::UpdateEffectiveValueParams * args = 0x0000001d`68d8e520)+0xdf [onecoreuap\windows\dxaml\xcp\components\dependencyobject\propertysystem.cpp @ 1979]
0b 0000001d`68d8e4e0 00007ffb`72baca5c Windows_UI_Xaml!CDependencyObject::SetValue(struct SetValueParams * args = 0x0000001d`68d8e820)+0xab [onecoreuap\windows\dxaml\xcp\components\dependencyobject\propertysystem.cpp @ 1740]
0c 0000001d`68d8e560 00007ffb`72bac042 Windows_UI_Xaml!CUIElement::SetValue(struct SetValueParams * args = 0x0000001d`68d8e820)+0xcc [onecoreuap\windows\dxaml\xcp\core\core\elements\uielement.cpp @ 784]
0d 0000001d`68d8e5f0 00007ffb`72bab03f Windows_UI_Xaml!CFrameworkElement::SetValue(struct SetValueParams * args = 0x0000001d`68d8e820)+0xa2 [onecoreuap\windows\dxaml\xcp\core\core\elements\framework.cpp @ 236]
0e 0000001d`68d8e6c0 00007ffb`72baa59d Windows_UI_Xaml!CControl::SetValue(struct SetValueParams * args = 0x0000001d`68d8e820)+0x2f [onecoreuap\windows\dxaml\xcp\core\core\elements\control.cpp @ 105]
0f 0000001d`68d8e740 00007ffb`72c9e6eb Windows_UI_Xaml!CContentControl::SetValue(struct SetValueParams * args = 0x0000001d`68d8e820)+0x6d [onecoreuap\windows\dxaml\xcp\core\core\elements\contentcontrol.cpp @ 114]
10 (Inline Function) --------`-------- Windows_UI_Xaml!DependencyObject_SetValue(void)+0x35 [onecoreuap\windows\dxaml\xcp\core\dll\pinvokes.cpp @ 2347]
11 0000001d`68d8e780 00007ffb`72c4219d Windows_UI_Xaml!DirectUI::DependencyObject::SetValueCore(struct SetValueParams * args = 0x0000001d`68d8e820, bool fSetEffectiveValueOnly = <Value unavailable error>)+0x17b [onecoreuap\windows\dxaml\xcp\dxaml\lib\dependencyobject.cpp @ 1052]
12 (Inline Function) --------`-------- Windows_UI_Xaml!DirectUI::DependencyObject::SetValueCore(void)+0x4d [onecoreuap\windows\dxaml\xcp\dxaml\lib\DependencyObject.h @ 273]
13 0000001d`68d8e7f0 00007ffb`511615f8 Windows_UI_Xaml!DirectUI::DependencyObject::SetValueByKnownIndex<unsigned char>(KnownPropertyIndex nPropertyIndex = ToolTip_IsOpen (0n1921), unsigned char value = 0x01 '')+0xdd [onecoreuap\windows\dxaml\xcp\dxaml\lib\DependencyObject.h @ 392]
14 0000001d`68d8e880 00007ffb`51178049 TerminalApp!winrt::impl::consume_Windows_UI_Xaml_Input_IKeyRoutedEventArgs<winrt::Windows::UI::Xaml::Input::IKeyRoutedEventArgs>::Handled(bool value = <Value unavailable error>)+0x14 [C:\a\_work\1\s\src\cascadia\TerminalApp\Generated Files\winrt\Windows.UI.Xaml.Input.h @ 583]
15 0000001d`68d8e8b0 00007ffb`5117a50a TerminalApp!`winrt::TerminalApp::implementation::MinMaxCloseControl::MinMaxCloseControl'::`2'::<lambda_1>::operator()(struct winrt::Windows::UI::Xaml::Controls::Button * button = 0x0000001d`68d8e968)+0x101 [C:\a\_work\1\s\src\cascadia\TerminalApp\MinMaxCloseControl.cpp @ 60]
16 (Inline Function) --------`-------- TerminalApp!std::invoke(void)+0x16 [C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.32.31326\include\type_traits @ 1488]
17 (Inline Function) --------`-------- TerminalApp!std::_Invoker_ret<void,1>::_Call(void)+0x16 [C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.32.31326\include\functional @ 664]
18 0000001d`68d8e930 00007ffb`51178172 TerminalApp!std::_Func_impl_no_alloc<`winrt::TerminalApp::implementation::MinMaxCloseControl::MinMaxCloseControl'::`2'::<lambda_1>,void,winrt::Windows::UI::Xaml::Controls::Button>::_Do_call(struct winrt::Windows::UI::Xaml::Controls::Button * <_Args_0> = <Value unavailable error>)+0x1a [C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.32.31326\include\functional @ 834]
19 (Inline Function) --------`-------- TerminalApp!std::_Func_class<void,winrt::Windows::UI::Xaml::Controls::Button>::operator()(void)+0x21 [C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.32.31326\include\functional @ 880]
1a (Inline Function) --------`-------- TerminalApp!std::invoke(void)+0x37 [C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.32.31326\include\type_traits @ 1488]
1b (Inline Function) --------`-------- TerminalApp!std::_Apply_impl(void)+0x37 [C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.32.31326\include\tuple @ 974]
1c (Inline Function) --------`-------- TerminalApp!std::apply(void)+0x37 [C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.32.31326\include\tuple @ 979]
1d 0000001d`68d8e960 00007ffb`51178e9d TerminalApp!`ThrottledFunc<0,winrt::Windows::UI::Xaml::Controls::Button>::_trailing_edge'::`3'::<lambda_1>::operator()(void)+0x9e [C:\a\_work\1\s\src\cascadia\WinRTUtils\inc\ThrottledFunc.h @ 116]
1e 0000001d`68d8e9c0 00007ffb`77f7ef20 TerminalApp!winrt::impl::delegate<winrt::Windows::System::DispatcherQueueHandler,`ThrottledFunc<0,winrt::Windows::UI::Xaml::Controls::Button>::_trailing_edge'::`3'::<lambda_1> >::Invoke(void)+0xd [C:\a\_work\1\s\src\cascadia\TerminalApp\Generated Files\winrt\Windows.System.h @ 1623]
1f 0000001d`68d8e9f0 00007ffb`77fa6244 CoreMessaging!Windows::System::DispatcherQueue::DeferInvokeCallback+0x20
20 0000001d`68d8ea20 00007ffb`77fa5cbe CoreMessaging!CFlat::SehSafe::Execute<<lambda_a81ff790741c2a62f2197c2561f5fe49> >+0x2c
21 0000001d`68d8ea50 00007ffb`77fb360f CoreMessaging!Microsoft::CoreUI::ActionCallback::ImportAdapter$+0xae
22 0000001d`68d8ea90 00007ffb`77fb1a63 CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCall::Callback_Dispatch+0x2bf
23 0000001d`68d8eb50 00007ffb`77fb23ef CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCallDispatcher::Callback_OnDispatch+0x3a3
24 0000001d`68d8ec00 00007ffb`77fb0033 CoreMessaging!Microsoft::CoreUI::Dispatch::EventLoop::Callback_RunCoreLoop+0x36f
25 0000001d`68d8ed10 00007ffb`77fafbf6 CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatch+0x1f3
26 0000001d`68d8eda0 00007ffb`77fad0ac CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::DoWork+0x206
27 0000001d`68d8ee30 00007ffb`8cbb8271 CoreMessaging!Microsoft::CoreUI::Dispatch::UserAdapter::WindowProc+0x14c
28 0000001d`68d8eea0 00007ffb`8cbb7f2c user32!UserCallWinProcCheckWow+0x2d1
29 0000001d`68d8f000 00007ffb`8cbc2ded user32!DispatchClientMessage+0x9c
2a 0000001d`68d8f060 00007ffb`8e8b2e44 user32!_fnDWORD+0x3d
2b 0000001d`68d8f0c0 00007ffb`8c3514d4 ntdll!KiUserCallbackDispatcherContinue
2c 0000001d`68d8f148 00007ffb`8cbc190f win32u!NtUserPeekMessage+0x14
2d 0000001d`68d8f150 00007ffb`8cbc17dc user32!_PeekMessage+0x3f
2e 0000001d`68d8f1c0 00007ffb`8b6e91d9 user32!PeekMessageW+0x9c
2f 0000001d`68d8f230 00007ffb`8b6e9248 InProcessClient64+0x991d9
30 0000001d`68d8f270 00007ffb`8b6e911c InProcessClient64+0x99248
31 0000001d`68d8f2b0 00007ffb`631114f5 InProcessClient64+0x9911c
32 0000001d`68d8f360 00007ffb`631139b9 Microsoft_Toolkit_Win32_UI_XamlHost+0x14f5
33 0000001d`68d8f3f0 00007ff7`1533c4d1 Microsoft_Toolkit_Win32_UI_XamlHost+0x39b9
34 0000001d`68d8f420 00007ff7`15338f2f WindowsTerminal!winrt::impl::consume_Windows_Foundation_IClosable<winrt::TerminalApp::App>::Close(void)+0x59 [C:\a\_work\1\s\src\cascadia\WindowsTerminal\Generated Files\winrt\Windows.Foundation.h @ 121]
35 0000001d`68d8f470 00007ff7`15328813 WindowsTerminal!AppHost::~AppHost(void)+0x1cb [C:\a\_work\1\s\src\cascadia\WindowsTerminal\AppHost.cpp @ 150]
36 0000001d`68d8f680 00007ff7`1531dfe2 WindowsTerminal!wWinMain+0xf193 [C:\a\_work\1\s\src\cascadia\WindowsTerminal\main.cpp @ 193]
37 (Inline Function) --------`-------- WindowsTerminal!invoke_main(void)+0x21 [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 118]
38 0000001d`68d8fa70 00007ffb`8c61247d WindowsTerminal!__scrt_common_main_seh(void)+0x106 [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 288]
39 0000001d`68d8fab0 00007ffb`8e86dfb8 kernel32!BaseThreadInitThunk+0x1d
3a 0000001d`68d8fae0 00000000`00000000 ntdll!RtlUserThreadStart+0x2
I need to fix symbols
KEY_VALUES_STRING: 1
Key : Analysis.CPU.mSec
Value: 15
Key : Analysis.DebugAnalysisManager
Value: Create
Key : Analysis.Elapsed.mSec
Value: 105
Key : Analysis.IO.Other.Mb
Value: 0
Key : Analysis.IO.Read.Mb
Value: 0
Key : Analysis.IO.Write.Mb
Value: 0
Key : Analysis.Init.CPU.mSec
Value: 139
Key : Analysis.Init.Elapsed.mSec
Value: 404587
Key : Analysis.Memory.CommitPeak.Mb
Value: 57
Key : Timeline.OS.Boot.DeltaSec
Value: 14363
Key : Timeline.Process.Start.DeltaSec
Value: 6
Key : WER.OS.Branch
Value: ni_release
Key : WER.OS.Timestamp
Value: 2022-05-06T12:50:00Z
Key : WER.OS.Version
Value: 10.0.22621.1
FILE_IN_CAB: WindowsTerminal.exe.1224.dmp
CONTEXT: (.ecxr)
rax=0000000000000000 rbx=0000001d68d8d7f0 rcx=0000000000000001
rdx=0000000000000070 rsi=0000000000000000 rdi=0000001d68d8d300
rip=00007ffb72f6ce69 rsp=0000001d68d8e060 rbp=0000001d68d8e090
r8=0000017c536b4820 r9=0000000000000000 r10=00000fff6e5cbcc7
r11=aa8aaaaaaaaaaaaa r12=0000000000000000 r13=0000017c5450cac0
r14=0000000000000000 r15=0000001d68d8e848
iopl=0 nv up ei pl zr na po nc
cs=0033 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010244
Windows_UI_Xaml!DllMain+0xb35b9:
00007ffb`72f6ce69 488b4340 mov rax,qword ptr [rbx+40h] ds:0000001d`68d8d830=0000000000000000
Resetting default scope
EXCEPTION_RECORD: (.exr -1)
ExceptionAddress: 00007ffb72f6ce69 (Windows_UI_Xaml!DllMain+0x00000000000b35b9)
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000001
NumberParameters: 2
Parameter[0]: 0000000000000000
Parameter[1]: 0000000000000040
Attempt to read from address 0000000000000040
PROCESS_NAME: ntdll.wrong.symbols.dll
WRONG_SYMBOLS_TIMESTAMP: a97a9ed6
WRONG_SYMBOLS_SIZE: 214000
FAULTING_MODULE: 00007ffb8e810000 ntdll
ADDITIONAL_DEBUG_TEXT:
You can run '.symfix; .reload' to try to fix the symbol path and load symbols. ; Followup set based on attribute [Is_ChosenCrashFollowupThread] from Frame:[0] on thread:[PSEUDO_THREAD]
FAULTING_THREAD: ffffffff
STACK_TEXT:
00000000`00000000 00000000`00000000 WRONG_SYMBOLS!WRONG_SYMBOLS+0x0
STACK_COMMAND: ** Pseudo Context ** ManagedPseudo ** Value: ffffffff ** ; kb
BUGCHECK_CODE: a97a9ed6
EXCEPTION_CODE_STR: A97A9ED6
EXCEPTION_STR: WRONG_SYMBOLS
IMAGE_NAME: ntdll.wrong.symbols.dll
MODULE_NAME: ntdll_wrong_symbols
SYMBOL_NAME: ntdll_wrong_symbols!A97A9ED6214000
FAILURE_BUCKET_ID: WRONG_SYMBOLS_X64_22621.1.amd64fre.ni_release.220506-1250_TIMESTAMP_600207-131918_A97A9ED6_ntdll.wrong.symbols.dll!A97A9ED6214000
OS_VERSION: 10.0.22621.1
BUILDLAB_STR: ni_release
OSPLATFORM_TYPE: x64
OSNAME: Windows 10
FAILURE_ID_HASH: {90a1e60c-1a60-d8e9-c755-95911af0d991}
Followup: MachineOwner
---------
Now that's the strangest stack I've ever seen! We're blowing up during an orderly shutdown (!!) trying to decom the tooltip on the min/max/close buttons.
What's puzzling is that AppHost
is explicitly tearing down. It only does that if the last tab exits... or, it should.
Yep, it was differente before WinDbg downloaded pdb files. Here is the same dump but with lldb:
(lldb) bt
* thread #1, stop reason = Exception 0xc0000005 encountered at address 0x7ffb72f6ce69
* frame #0: 0x00007ffb72f6ce69 Windows.UI.Xaml.dll`DllMain + 734649
frame #1: 0x00007ffb736d4b1e Windows.UI.Xaml.dll`GetStringRawBuffer + 4166398
frame #2: 0x00007ffb736d44f2 Windows.UI.Xaml.dll`GetStringRawBuffer + 4164818
frame #3: 0x00007ffb72f2407e Windows.UI.Xaml.dll`DllMain + 436174
frame #4: 0x00007ffb72ba06a2 Windows.UI.Xaml.dll`GetErrorContextIndex + 125426
frame #5: 0x00007ffb72bb071f Windows.UI.Xaml.dll`GetErrorContextIndex + 191087
frame #6: 0x00007ffb72bae8ef Windows.UI.Xaml.dll`GetErrorContextIndex + 183359
frame #7: 0x00007ffb72bae74b Windows.UI.Xaml.dll`GetErrorContextIndex + 182939
frame #8: 0x00007ffb72baca5c Windows.UI.Xaml.dll`GetErrorContextIndex + 175532
frame #9: 0x00007ffb72bac042 Windows.UI.Xaml.dll`GetErrorContextIndex + 172946
frame #10: 0x00007ffb72bab03f Windows.UI.Xaml.dll`GetErrorContextIndex + 168847
frame #11: 0x00007ffb72baa59d Windows.UI.Xaml.dll`GetErrorContextIndex + 166125
frame #12: 0x00007ffb72c9e6eb Windows.UI.Xaml.dll`DllGetActivationFactory + 203547
frame #13: 0x00007ffb72c4219d Windows.UI.Xaml.dll`GetErrorContextIndex + 787693
frame #14: 0x00007ffb511615f8 TerminalApp.dll`DllCanUnloadNow + 137752
frame #15: 0x00007ffb51178049 TerminalApp.dll`DllCanUnloadNow + 230505
frame #16: 0x00007ffb5117a50a TerminalApp.dll`DllCanUnloadNow + 239914
frame #17: 0x00007ffb51178172 TerminalApp.dll`DllCanUnloadNow + 230802
frame #18: 0x00007ffb51178e9d TerminalApp.dll`DllCanUnloadNow + 234173
frame #19: 0x00007ffb77f7ef20 CoreMessaging.dll`CoreUICreateEx + 176
frame #20: 0x00007ffb77fa6244 CoreMessaging.dll`CoreUICallReceive + 8244
frame #21: 0x00007ffb77fa5cbe CoreMessaging.dll`CoreUICallReceive + 6830
frame #22: 0x00007ffb77fb360f CoreMessaging.dll`CoreUICallReceive + 62463
frame #23: 0x00007ffb77fb1a63 CoreMessaging.dll`CoreUICallReceive + 55379
frame #24: 0x00007ffb77fb23ef CoreMessaging.dll`CoreUICallReceive + 57823
frame #25: 0x00007ffb77fb0033 CoreMessaging.dll`CoreUICallReceive + 48675
frame #26: 0x00007ffb77fafbf6 CoreMessaging.dll`CoreUICallReceive + 47590
frame #27: 0x00007ffb77fad0ac CoreMessaging.dll`CoreUICallReceive + 36508
frame #28: 0x00007ffb8cbb8271 user32.dll`DispatchMessageW + 1857
frame #29: 0x00007ffb8cbb7f2c user32.dll`DispatchMessageW + 1020
frame #30: 0x00007ffb8cbc2ded user32.dll`GetClassLongW + 1421
frame #31: 0x00007ffb8e8b2e44 ntdll.dll`KiUserCallbackDispatcher + 36
frame #32: 0x00007ffb8c3514d4 win32u.dll`NtUserPeekMessage + 20
frame #33: 0x00007ffb8cbc190f user32.dll`PeekMessageW + 463
frame #34: 0x00007ffb8cbc17dc user32.dll`PeekMessageW + 156
frame #35: 0x00007ffb8b6e91d9 InProcessClient64.dll
frame #36: 0x00007ffb8b6e9248 InProcessClient64.dll
frame #37: 0x00007ffb8b6e911c InProcessClient64.dll
frame #38: 0x00007ffb631114f5 Microsoft.Toolkit.Win32.UI.XamlHost.dll
frame #39: 0x00007ffb631139b9 Microsoft.Toolkit.Win32.UI.XamlHost.dll
frame #40: 0x00007ff71533c4d1 WindowsTerminal.exe
frame #41: 0x00007ff715338f2f WindowsTerminal.exe
frame #42: 0x00007ff715328813 WindowsTerminal.exe
frame #43: 0x00007ff71531dfe2 WindowsTerminal.exe
frame #44: 0x00007ffb8c61247d kernel32.dll`BaseThreadInitThunk + 29
frame #45: 0x00007ffb8e86dfb8 ntdll.dll`RtlUserThreadStart + 40
Turned out I had two PSReadLine modules. One was a part of pwsh 7 (2.2.6) and another was installed previously (2.2.0). I removed the older one and left only the one that is part of pwsh. Will check how it works now.
Another obeservation, not sure if it is important or relevant. It is my understanding that there must be one OpenConsole.exe per one pwsh. Right now, I see 4 OpenConsole processes and one pwsh. All are created by WT. When I open 3 of OCs via ProcessHacker, and look at Handles searching for handles to Processes, I see Non-Existent Process. One has a handle to the running pwsh.exe, the 3 others looks like hanged because contain handle to nonexistent process, i.e. pwsh died or was closed (did not investigate this), but the openconsole is still running.
Maybe I misundersand how it supposed to work.
Also I see 4 pwsh.exe are marked as Suspended and one WT as well. But they did not match the handles in OpenConsole.
The state of things is: pwsh uses PSReadLine 2.2.6 from pwsh installation, I turned off some services like RuntimeBroker, attached WinDbg to pwsh and openconsole and things are stable so far. Looks like it was not caused by WT or pwsh but some wndows related issues.
Thanks so much for following up! If it does come back & we can get line of sight on it being Terminal's responsibility, please do reopen/let us know!
@DHowett thanks, but I am still not happy about what is happening. Something strange. I have 3 terminals - WT, Alacritty and WezTerm. All use the same pwsh.exe. But when I close the lid or computer goes to sleep, it is only WT that is being closed. Now I think that it is closing for some reason and causes pwsh.exe to be closed. I see there is trace logging capability in WT. What is the best doc page to read on how to turn it on? I tried using WinDbg and bp on AppHost::_Quit... methods, but WinDbg disappears as well. Tried using procdump with -t. Same outcome, it just goes away and no dump is generated. Trying to catch what is causing some apps to close. Skype is closing as well. I have to run it on every log in. Annoying.
Excellent observations! We've got a quick doc on capturing a trace at https://github.com/microsoft/terminal/wiki/Capturing-a-Debug-ETL-Trace :)
I've reopened the issue for now as it looks pretty darn likely that it's us :P
I did the WPR, but I think I found something that is almost embarrassing - in the Settings - Apps - Installed Apps - WindowsTerminalPreview, the setting "Let this app run in background" was set to Never. Same was done for Skype. Checking could this impact the working on WT or no.
Yes, that was it :) You can close the ticket.
Though I have a suggestion - maybe WT can check that settings (it is available via registry, get appx name and it is here - HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications\Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe
The settings are DisabledByUser and Disabled.
At least warn the user. And another observation, looks like there is .net crash, when its pipe losing the other side and cannot read the data. It crashes.
For some reason, only recently this problem has been closing WT. I did set the background permission to "Always", but seems that shouldn't be necessary to prevent my terminal from tearing down and taking any ephemeral env vars with it. This has been happening a lot in the last few days (though nothing I've noticed has otherwise changed other than a recent .NET 7 update). Just a bit ago I walked away from lunch in the middle of some testing, came back, and WT was gone. Same as this morning. The only trace of a problem was from the Application event log:
Application: pwsh.exe
CoreCLR Version: 7.0.323.6910
.NET Version: 7.0.3
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidOperationException: Cannot read keys when either application does not have a console or when console input has been redirected. Try Console.Read.
at System.ConsolePal.ReadKey(Boolean intercept)
at Microsoft.PowerShell.PSConsoleReadLine.ReadOneOrMoreKeys()
at Microsoft.PowerShell.PSConsoleReadLine.ReadKeyThreadProc()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
At least in this case, pwsh was the only tab open. I often have wsl (Ubuntu / bash) open as well, though I don't recall off hand if WT was terminated or not. I only started suspecting that I didn't accidentally type exit
myself and that something else was amiss.
pwsh is 7.3.3 and PSReadLine is 2.2.6. /cc @stevel-msft, though I didn't see any similar bugs in powershell/powershell.
Update: this last time wt.exe was killed by pwsh.exe crashing, I definitely had bash running in WSL2 and both shells (tabs) were taken down. Don't know if it matters (this bug is older), but I did also recently update to the March 2023 cumulative update for Windows 11. Did pseudo-TTY support get updated to cause this break? Come to think of it, I don't recall experiencing this problem before that ever.
Per offline discussion, I'm going to try to downgrade to PowerShell 7.3.2 and run that way for a while, but whatever caused wt.exe to ultimately terminate (whether pwsh.exe's fault or not) seems to have deadlocked WSL2. No wsl.exe commands - not --list
, --status
, --shutdown
, and some others I tried - would do anything. Command just "hung" until Ctrl+C. I'm using the Windows Store version of the linux kernel.
For me it continues to happen even after all updates, incl windows update, pwsh update and so on. At the same time, the same issue happens with Skype installed through MS Store. After I switched to Skype for Desktop, it is now only the WT that crashes during sleep. And I talk about sleep, not hibernate:
❯ powercfg /a
The following sleep states are available on this system:
Standby (S0 Low Power Idle) Network Connected
Skype (from MS Store) does crash because it keeps the icon in the notification area, just as if process was killed and did not clean up the resources properly.
Actually, it would be interesting to try WT with cmd shells, no pwsh. Will try that. But at the same time, I have wizterm open and it never crashes. So it seems to me like there is something related to the apps installed from MS Store. I tried disabling developer mode, but that did not help (there is some advice on how to do that).
BTW, I opened the latest crash report, here was the .NET exception:
0:012> !printexception
Exception object: 0000019ad8ea0b68
Exception type: System.InvalidOperationException
Message: Cannot read keys when either application does not have a console or when console input has been redirected. Try Console.Read.
InnerException: <none>
StackTrace (generated):
SP IP Function
0000004677C8F880 00007FF92DE44ECD System_Console!System.ConsolePal.ReadKey(Boolean)+0x22d
0000004677C8F980 00007FF92DE46DA1 Microsoft_PowerShell_PSReadLine2!Microsoft.PowerShell.PSConsoleReadLine.ReadOneOrMoreKeys()+0x3c1
0000004677C8FA60 00007FF92BB966AE Microsoft_PowerShell_PSReadLine2!Microsoft.PowerShell.PSConsoleReadLine.ReadKeyThreadProc()+0x4e
0000004677C8FAD0 00007FF989B0C8A8 System_Private_CoreLib!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)+0x5db8cf48
0000004677C8FAA0 00007FF92C0C7749 System_Private_CoreLib!System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()+0x39
0000004677C8FAD0 00007FF989B0C922 System_Private_CoreLib!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)+0x5db8cfc2
Also, to collect all details in this post - some time ago I started to suspect that this process may be related to the issues: TextInputHost.exe which is a part of this appx: C:\Windows\SystemApps\MicrosoftWindows.Client.CBS_cw5n1h2txyewy
And another interesting observation - wezterm uses conhost with pwsh while WT uses OpenConsole, could that be a reason one survives sleep and other does not?
@DHowett even after downgrading to PowerShell 7.3.2 the problem still happened i.e., that might laptop went to sleep and when I woke it up, wt.exe was closed. Seems like it happened around the time the laptop would've entered S1 given the .NET Runtime application log event.
I'm also seeing a lot of the TextInputHost.exe crashes, though whether it's the cause or a symptom I couldn't say. But lots of them I hadn't noticed before.
@wisemanny what OS/version are you on?
Hmmmm... Terminal 1.16 didn't have the conpty lifetime changes in it... does it?
Should this bug be reopened, or should I open a new one if this might be a different cause?
I'll reopen it for now. Thanks for all the info, and sorry it's persisted!
@wisemanny what OS/version are you on?
Windows 11, latest release build
WindowsProductName : Windows 10 Pro OsHardwareAbstractionLayer : 10.0.22621.819
I posted this to another issue (https://github.com/microsoft/terminal/issues/12513)
Maybe this can be helpful, I used DebugDiag tool to try to get dump upon WT termination, but in the log I see such exceptions (I can provide the complete file):
1 ***********************
2 * EXCEPTION DETAILS *
3 ***********************
4
5 DetailID = 1
6 Count: 2
7 Exception #: 0X000006BF
8 Stack:
9 KERNELBASE!RaiseException+0x6c
10 RPCRT4!RpcRaiseException+0x50
11 RPCRT4!RpcRaiseException+0x14
12 RPCRT4!NdrSendReceive+0x66
13 RPCRT4!NdrClientCall3+0xc6a
14 RPCRT4!NdrClientCall3+0xeb
15 AppXDeploymentClient!Ordinal1+0x32e3
16 AppXDeploymentClient!VerifyPackage+0x2b
17 AppExtension!<lambda_b1ef69a29c93702515289cac97ab3bfc>::operator()+0x3f
18 AppExtension!Windows::Internal::COperationLambdaVar<0,<lambda_b1ef69a29c93702515289cac97ab3bfc>,Windows::Internal::CMarshaledInterfaceResult<Windows::Storage::IStorageFolder> >::Run+0x23 19 AppExtension!Windows::Internal::AsyncOperation<Windows::Foundation::IAsyncOperation<Windows::Storage::StorageFolder * __ptr64>,Windows::Foundation::IAsyncOperationCompletedHandler<Window s::Storage::StorageFolder * __ptr64>,Windows::Internal::CMarshaledInterfaceResult<Windows::Storage::IStorageFolder>,Windows::Internal::ComTaskPoolHandler,Windows::Internal::INilDelegate,Microsof t::WRL::AsyncOptions<-1,0,&GUID_CAUSALITY_WINDOWS_PLATFORM_ID,2> >::_Run+0xfa
20 AppExtension!Windows::Internal::AsyncOperation<Windows::Foundation::IAsyncOperation<Windows::Storage::StorageFolder * __ptr64>,Windows::Foundation::IAsyncOperationCompletedHandler<Window s::Storage::StorageFolder * __ptr64>,Windows::Internal::CMarshaledInterfaceResult<Windows::Storage::IStorageFolder>,Windows::Internal::ComTaskPoolHandler,Windows::Internal::INilDelegate,Microsof t::WRL::AsyncOptions<-1,0,&GUID_CAUSALITY_WINDOWS_PLATFORM_ID,2> >::Run+0x69
21 shcore!WorkThreadManager::CThread::ThreadProc+0x26a
22 shcore!WorkThreadManager::CThread::s_ExecuteThreadProc+0x22
23 shcore!<lambda_9844335fc14345151eefcc3593dd6895>::<lambda_invoker_cdecl>+0x11
24 KERNEL32!BaseThreadInitThunk+0x1d
25 ntdll!RtlUserThreadStart+0x28
There are a few more:
1 DetailID = 2
2 Count: 1
3 Exception #: 0XE06D7363
4 Stack:
5 KERNELBASE!RaiseException+0x6c
6 ucrtbase!CxxThrowException+0x9a
7 Bcp47Langs!Bcp47Normalize+0xfe5c
8 Bcp47Langs!NormalizeLanguageTag+0x81
9 Bcp47Langs!ApplicationLanguages::GetApplicationLanguageOverride+0x58
10 Bcp47Langs!GetApplicationLanguageOverride+0x43
11 Windows_Globalization!Windows::Globalization::ApplicationLanguages::get_PrimaryLanguageOverride+0x11 [onecoreuap\base\win32\winnls\winrt\dll\applicationpreferences.cpp @ 44]
12 TerminalApp!DllGetActivationFactory+0x1f150
13 TerminalApp!DllGetActivationFactory+0x59c59
14 TerminalApp!DllGetActivationFactory+0x425c4
15 TerminalApp!DllCanUnloadNow+0xd7a6
16 WindowsTerminal+0x3264c
17 WindowsTerminal+0x8540
18 WindowsTerminal+0x34d24
19 WindowsTerminal+0x7d40
20 WindowsTerminal+0x71d1
21 WindowsTerminal+0xad97
22 user32!DispatchMessageW+0x741
23 user32!DispatchMessageW+0x3fc
24 user32!IsRectEmpty+0x9a
and longer stack
and this one
1 DetailID = 3
2 Count: 1
3 Exception #: 0XE06D7363
4 Stack:
5 KERNELBASE!RaiseException+0x6c
6 ucrtbase!CxxThrowException+0x9a
7 Bcp47Langs!Bcp47Normalize+0xfe5c
8 Bcp47Langs!NormalizeLanguageTag+0x81
9 Bcp47Langs!ApplicationLanguages::GetApplicationLanguageOverride+0x58
10 Bcp47Langs!GetApplicationLanguageOverride+0x43
11 Windows_Globalization!Windows::Globalization::ApplicationLanguages::get_PrimaryLanguageOverride+0x11 [onecoreuap\base\win32\winnls\winrt\dll\applicationpreferences.cpp @ 44]
12 TerminalApp!DllGetActivationFactory+0x1f150
13 TerminalApp!DllGetActivationFactory+0x59c59
14 TerminalApp!DllGetActivationFactory+0x425c4
15 TerminalApp!DllCanUnloadNow+0xd7a6
16 WindowsTerminal+0x3264c
17 WindowsTerminal+0x8540
18 WindowsTerminal+0x34d24
19 WindowsTerminal+0x7d40
20 WindowsTerminal+0x71d1
21 WindowsTerminal+0xad97
22 user32!DispatchMessageW+0x741
23 user32!DispatchMessageW+0x3fc
24 user32!IsRectEmpty+0x9a
25 ntdll!KiUserCallbackDispatcherContinue
26 win32u!NtUserGetMessage+0x14
27 user32!GetMessageW+0x2a
28 InProcessClient64+0x97516
29 InProcessClient64+0x97455
30 WindowsTerminal+0x6877
31 WindowsTerminal+0xef62
32 KERNEL32!BaseThreadInitThunk+0x1d
33 ntdll!RtlUserThreadStart+0x28
Huh. That's a weird stack for sure. The call to AppLogic::_ApplyLanguageSettingChange
(which is where we call into get_PrimaryLanguageOverride
) is wrapped in a try
/catch
, so I wouldn't expect that to be able to crash the Terminal. The StorageFolder
one is a little trickier, I can't put my finger on that one exactly. Both of those are places that are likely to crash when the Terminal is running unpackaged, but that seems unlikely if the Terminal was installed from the Store.
Perhaps this is just that PLM/{someone} bug that recently regressed and got really aggressive at killing the Terminal (and other packaged apps), and the stack just so happened to be there when the Terminal got taken down.
According to winget, I did install WT on this machine where it's crashing directly via the MSIX. Store takes forever to make updates available - even a week after release announcement, at times - so I guess I got impatient and upgraded via winget. I can uninstall and re-install from the Store, but at this point it seems better to leave it in this state and help find the bug. I talked with @DHowett offline and will trace pwsh.exe and OpenConsole.exe.
I think mine was installed from the github, but for sure it was updated via winget. I am attaching the complete log files from the debugdiag tool just in case. I set it up now to log all exceptions from openconsole, pwsh and wt. If those may be helpful I am happy to send a attach a copy of them as well.
[WindowsTerminalPID8516Date03_12_2023Time_11_26_52AM841Log.txt] (https://github.com/microsoft/terminal/files/10966011/WindowsTerminal__PID__26980__Date__03_12_2023__Time_06_18_06PM772Log.txt) [WindowsTerminalPID26980Date03_12_2023Time_06_18_06PM772Log.txt] (https://github.com/microsoft/terminal/files/10966003/WindowsTerminal__PID__8516__Date__03_12_2023__Time_11_26_52AM__841__Log.txt)
P.S. I reattached zip. It contains WT + two pwsh.exe and two openconsole.exe log files created by DebugDiag. Some are long because I was using WT for some time and it was generating exceptions. But all those processes did terminate during the sleep. I did not shut any of them down manually.
I notice this on my Surface Pro 9 (SQ3) but not on my Lenovo Intel machines
I am going to collect a new set of logs and attach "powercfg /sleepstudy" report as well. It would be interesting to see with what sleep event it coincides with.
OK, so some observations.
Time | Dur | State | Reason |
---|---|---|---|
12:27:46 | 0:00:00 | Screen Off | Lid |
12:27:46 | 0:06:28 | Sleep | Transition To Sleep |
12:34:14 | 0:00:48 | Active |
@wisemanny nice analysis, and confirms what I was thinking given the pwsh termination message, "Cannot read keys when either application does not have a console or when console input has been redirected." Really sounded like the console was already closed and that's why pwsh crashed.
Yesterday came out KB5023778, so far looks like the issue is fixed. I will continue observing.
Windows Terminal version
1.16.2642.0
Windows build number
10.0.22621.0
Other Software
pwsh 7.3.0 PSReadLine 2.26
Steps to reproduce
Open terminal Open a tab with pwsh and a tab with cmd Close lid (Surface Book 3) or get OS to sleep Wake up and log in to session
Expected Behavior
WT is there and all tabs are open
Actual Behavior
WT is closed. I will add more details in the comment below.