microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.74k stars 8.33k forks source link

If WARP is not used, stdout causes a crash and leak when RDP is disconnected (deadlock in `ControlCore::SizeChanged`) #13705

Closed TGSAN closed 1 year ago

TGSAN commented 2 years ago

Windows Terminal version

1.15.2002.0

Windows build number

10.0.22622.450

Other Software

ffmpeg 5.0

Steps to reproduce

  1. Use RDP(mstsc/msrdc) to connect the remote Windows (Physical graphics card already installed).
  2. (In Remote) Open Windows Terminal 1.15.2002.0
  3. (In Remote) Continuous live streaming or media format conversion using ffmpeg in Windows Terminal. (Because ffmpeg continuously outputs the current state via stdout)
  4. Disconnect RDP.
  5. Wait a while.

Expected Behavior

No response

Actual Behavior

  1. Windows Termianl and running command line programs can crash.
  2. If RDP is disconnected for a long time (e.g. several hours), it will exhaust the system resources and render the operating system unusable
  3. If "Use software rendering (WARP)" is turned on in Windows Termianl settings, this problem does not occur (it is suspected that GPU rendering tasks are piling up after RDP is disconnected, but cannot be processed)
zadjii-msft commented 2 years ago

Hmm. This sounds like the #12607 hang/crash, or at least some variation on it (a la #13386). That's a great observation that switching to software rendering works as a workaround. That would get out off the GPU, preventing the deadlocks via GPU driver code calling back to the main thread.

I'd love to get a dump of the terminal in this hung state from you if at all possible. We've got two different sets of hangs possible now - I'd love to have a solid confirmation that what you're seeing matches one of those signatures. If not, well then, that's just another mole we'd have to whack 😄

(maybe also related: #12176)

zadjii-msft commented 2 years ago

Can you repro this with the Feedback Hub for me? I think that'll get me a dump that I can use to positively dedupe this with one of the other crashes we got around here.

/feedback

ghost commented 2 years ago

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!

image

image

image

TGSAN commented 2 years ago

Can you repro this with the Feedback Hub for me? I think that'll get me a dump that I can use to positively dedupe this with one of the other crashes we got around here.

/feedback

I just reproduced this bug and submitted it via Feedback Hub, the link is here: https://aka.ms/AAhp3pr

zadjii-msft commented 2 years ago

INTERESTING. This is a different deadlock. it's in SizeChanged, but it's decidedly not #12176. That issue is a crash in teardown. This is a deadlock?

main thread

0:000> k
 # Child-SP          RetAddr               Call Site
00 00000028`8fcfd268 00007ffb`d0944065     ntdll!ZwWaitForAlertByThreadId+0x14 [minkernel\ntdll\daytona\objfre\amd64\usrstubs.asm @ 4059] 
01 00000028`8fcfd270 00007ffb`d096005c     ntdll!RtlpWaitOnAddressWithTimeout+0x81 [minkernel\ntos\rtl\waitaddr.c @ 851] 
02 00000028`8fcfd2a0 00007ffb`d095c123     ntdll!RtlpWaitOnAddress+0xd8 [minkernel\ntos\rtl\waitaddr.c @ 1094] 
03 00000028`8fcfd310 00007ffb`cde66003     ntdll!RtlWaitOnAddress+0x13 [minkernel\ntos\rtl\waitaddr.c @ 946] 
04 00000028`8fcfd350 00007ffb`5b921ce5     KERNELBASE!WaitOnAddress+0x33 [minkernel\kernelbase\synch.c @ 2258] 
05 (Inline Function) --------`--------     Microsoft_Terminal_Control!til::atomic_wait+0x18 [C:\a\_work\1\s\src\inc\til\atomic.h @ 13] 
06 00000028`8fcfd390 00007ffb`5b921c74     Microsoft_Terminal_Control!til::ticket_lock::lock+0x61 [C:\a\_work\1\s\src\inc\til\ticket_lock.h @ 35] 
07 00000028`8fcfd3d0 00007ffb`5b98c65c     Microsoft_Terminal_Control!std::unique_lock<til::ticket_lock>::unique_lock<til::ticket_lock>+0x18 [C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\mutex @ 135] 
08 (Inline Function) --------`--------     Microsoft_Terminal_Control!Microsoft::Terminal::Core::Terminal::LockForWriting+0x11 [C:\a\_work\1\s\src\cascadia\TerminalCore\Terminal.cpp @ 963] 
09 00000028`8fcfd400 00007ffb`5b98c5c6     Microsoft_Terminal_Control!winrt::Microsoft::Terminal::Control::implementation::ControlCore::SizeChanged+0x5c [C:\a\_work\1\s\src\cascadia\TerminalControl\ControlCore.cpp @ 869] 
0a 00000028`8fcfd450 00007ffb`5b974b0a     Microsoft_Terminal_Control!winrt::impl::produce<winrt::Microsoft::Terminal::Control::implementation::ControlCore,winrt::Microsoft::Terminal::Control::IControlCore>::SizeChanged+0x16 [C:\a\_work\1\s\src\cascadia\TerminalControl\Generated Files\winrt\Microsoft.Terminal.Control.h @ 1987] 
0b (Inline Function) --------`--------     Microsoft_Terminal_Control!winrt::impl::consume_Microsoft_Terminal_Control_IControlCore<winrt::Microsoft::Terminal::Control::IControlCore>::SizeChanged+0x17 [C:\a\_work\1\s\src\cascadia\TerminalControl\Generated Files\winrt\Microsoft.Terminal.Control.h @ 200] 
0c (Inline Function) --------`--------     Microsoft_Terminal_Control!winrt::Microsoft::Terminal::Control::implementation::TermControl::_SwapChainSizeChanged+0x25705 [C:\a\_work\1\s\src\cascadia\TerminalControl\TermControl.cpp @ 1688] 
0d (Inline Function) --------`--------     Microsoft_Terminal_Control!winrt::Microsoft::Terminal::Control::implementation::TermControlT<winrt::Microsoft::Terminal::Control::implementation::TermControl>::Connect::__l14::<lambda_22>::operator()+0x2571a [C:\a\_work\1\s\src\cascadia\TerminalControl\Generated Files\TermControl.xaml.g.hpp @ 232] 
0e 00000028`8fcfd480 00007ffb`c7b547a4     Microsoft_Terminal_Control!winrt::impl::delegate<winrt::Windows::UI::Xaml::SizeChangedEventHandler,`winrt::Microsoft::Terminal::Control::implementation::TermControlT<winrt::Microsoft::Terminal::Control::implementation::TermControl>::Connect'::`14'::<lambda_22> >::Invoke+0x2573a [C:\a\_work\1\s\src\cascadia\TerminalControl\Generated Files\winrt\Windows.UI.Xaml.h @ 4682] 
0f 00000028`8fcfd4d0 00007ffb`c7b544ea     

but the renderer thread is

  52  Id: 7fec.7530 Suspend: 0 Teb: 00000028`8fa36000 Unfrozen "Rendering Output Thread"
 # Child-SP          RetAddr               Call Site
00 00000028`9139ed48 00007ffb`cde29b5e     ntdll!ZwWaitForSingleObject+0x14 [minkernel\ntdll\daytona\objfre\amd64\usrstubs.asm @ 251] 
01 00000028`9139ed50 00007ffb`c0cef676     KERNELBASE!WaitForSingleObjectEx+0x8e [minkernel\kernelbase\synch.c @ 1328] 
02 00000028`9139edf0 00007ffb`c0cf0700     nvwgf2umx_cfg!cask::SafeEnum<cask::md::Algorithm_ENUMCLASS_SCOPEWRAPPER>::operator=+0xa1fe6
03 00000028`9139f370 00007ffb`c0cf2578     nvwgf2umx_cfg!cask::SafeEnum<cask::md::Algorithm_ENUMCLASS_SCOPEWRAPPER>::operator=+0xa3070
04 00000028`9139f3a0 00007ffb`c0ce8bc3     nvwgf2umx_cfg!cask::SafeEnum<cask::md::Algorithm_ENUMCLASS_SCOPEWRAPPER>::operator=+0xa4ee8
05 00000028`9139f3f0 00007ffb`ca0576f7     nvwgf2umx_cfg!cask::SafeEnum<cask::md::Algorithm_ENUMCLASS_SCOPEWRAPPER>::operator=+0x9b533
06 (Inline Function) --------`--------     d3d11!CResource<ID3D11Texture2D1>::CLS::FinalRelease+0x63 [onecoreuap\windows\directx\dxg\d3d11\D3DCore\Inc\Resource.inl @ 1460] 
07 00000028`9139f430 00007ffb`ca05dce4     d3d11!TCLSWrappers<CTexture2D>::CLSDestroy+0x87 [onecoreuap\windows\directx\dxg\d3d11\Common\Inc\D3D11Layered.hpp @ 225] 
08 (Inline Function) --------`--------     d3d11!CCLSFinalReleaseSentinel<CContext>::{dtor}+0x9 [onecoreuap\windows\directx\dxg\d3d11\Common\Inc\D3D11Layered.inl @ 347] 
09 (Inline Function) --------`--------     d3d11!CLayeredObjectWithCLS<CTexture2D>::{dtor}+0x1e [onecoreuap\windows\directx\dxg\d3d11\Common\Inc\D3D11Layered.inl @ 440] 
0a 00000028`9139f460 00007ffb`ca0611f9     d3d11!CLayeredObjectWithCLS<CTexture2D>::Release+0x24 [onecoreuap\windows\directx\dxg\d3d11\Common\Inc\D3D11Layered.inl @ 453] 
0b (Inline Function) --------`--------     d3d11!ATL::AtlComPtrAssign+0x17 [onecore\external\sdk\inc\atlmfc\atlcomcli.h @ 58] 
0c (Inline Function) --------`--------     d3d11!ATL::CComPtr<ID3D11LayeredUseCounted>::operator=+0x20 [onecore\external\sdk\inc\atlmfc\atlcomcli.h @ 267] 
0d (Inline Function) --------`--------     d3d11!CD3D11LayeredChild<ID3D11DeviceChild,NDXGI::CDevice,64>::FinalRelease+0x20 [onecoreuap\windows\directx\dxg\d3d11\Common\Inc\D3D11Layered.inl @ 254] 
0e 00000028`9139f490 00007ffb`ca05fda3     d3d11!NDXGI::CDeviceChild<IDXGIResource1,IDXGISwapChainInternal>::FinalRelease+0x29 [onecoreuap\windows\directx\dxg\d3d11\D3DCore\Inc\DXGIDevice.inl @ 999] 
0f (Inline Function) --------`--------     d3d11!NDXGI::CResource::FinalRelease+0x2b [onecoreuap\windows\directx\dxg\d3d11\D3DCore\Inc\DXGIResource.inl @ 410] 
10 (Inline Function) --------`--------     d3d11!CLayeredObject<NDXGI::CResource>::{dtor}+0x39 [onecoreuap\private\windows\inc\directx\dxg\Layered.inl @ 125] 
11 00000028`9139f4c0 00007ffb`ca06fe29     d3d11!CLayeredObject<NDXGI::CResource>::Release+0x43 [onecoreuap\private\windows\inc\directx\dxg\Layered.inl @ 139] 
12 00000028`9139f4f0 00007ffb`ca040051     d3d11!ATL::AtlComPtrAssign+0x39 [onecore\external\sdk\inc\atlmfc\atlcomcli.h @ 59] 
13 (Inline Function) --------`--------     d3d11!ATL::CComPtr<ID3D11LayeredUseCounted>::operator=+0xd [onecore\external\sdk\inc\atlmfc\atlcomcli.h @ 267] 
14 00000028`9139f520 00007ffb`ca03eabc     d3d11!NOutermost::CDeviceChild::FinalRelease+0x39 [onecoreuap\windows\directx\dxg\d3d11\D3DCore\Inc\Outermost.inl @ 822] 
15 (Inline Function) --------`--------     d3d11!CDelegatingUseCountedObject<NOutermost::CDeviceChild>::FinalRelease+0x5 [onecoreuap\windows\directx\dxg\d3d11\D3DCore\Inc\Outermost.inl @ 560] 
16 00000028`9139f550 00007ffb`ca03ea84     d3d11!CDelegatingUseCountedObject<NOutermost::CDeviceChild>::~CDelegatingUseCountedObject<NOutermost::CDeviceChild>+0x18 [onecoreuap\windows\directx\dxg\d3d11\D3DCore\Inc\Outermost.inl @ 568] 
17 00000028`9139f580 00007ffb`ca0404dd     d3d11!CDelegatingUseCountedObject<NOutermost::CDeviceChild>::`scalar deleting destructor'+0x14
18 (Inline Function) --------`--------     d3d11!CDelegatingUseCountedObject<NOutermost::CDeviceChild>::Delete+0x1f [onecoreuap\windows\directx\dxg\d3d11\D3DCore\Inc\Outermost.inl @ 648] 
19 00000028`9139f5b0 00007ffb`cb52a89c     d3d11!CDelegatingUseCountedObject<NOutermost::CDeviceChild>::UCDestroy+0x2d [onecoreuap\windows\directx\dxg\d3d11\D3DCore\Inc\Outermost.inl @ 613] 
1a 00000028`9139f5e0 00007ffb`cb52a7c5     dxgi!CDXGISwapChain::DestroyOwnedBuffer+0x6c [onecoreuap\windows\directx\dxg\dxgi\dll\swapchan.cpp @ 1689] 
1b 00000028`9139f610 00007ffb`cb534080     dxgi!CDXGISwapChain::DestroyBackBuffers+0x65 [onecoreuap\windows\directx\dxg\dxgi\dll\swapchan.cpp @ 1636] 
1c 00000028`9139f640 00007ffb`cb533e78     dxgi!CDXGISwapChain::ScenarioResizeBuffers+0x64 [onecoreuap\windows\directx\dxg\dxgi\dll\swapchan.cpp @ 8697] 
1d 00000028`9139f720 00007ffb`5b967e17     dxgi!CDXGISwapChain::ResizeBuffers+0x168 [onecoreuap\windows\directx\dxg\dxgi\dll\swapchan.cpp @ 7327] 
1e 00000028`9139f890 00007ffb`5b916530     Microsoft_Terminal_Control!Microsoft::Console::Render::DxEngine::StartPaint+0x47817 [C:\a\_work\1\s\src\renderer\dx\DxRenderer.cpp @ 1315] 
1f 00000028`9139f9b0 00007ffb`5b9162ba     Microsoft_Terminal_Control!Microsoft::Console::Render::Renderer::_PaintFrameForEngine+0x7c [C:\a\_work\1\s\src\renderer\base\renderer.cpp @ 121] 
20 00000028`9139fa50 00007ffb`5b916221     Microsoft_Terminal_Control!Microsoft::Console::Render::Renderer::PaintFrame+0x4a [C:\a\_work\1\s\src\renderer\base\renderer.cpp @ 78] 
21 00000028`9139fa80 00007ffb`cfd5244d     Microsoft_Terminal_Control!Microsoft::Console::Render::RenderThread::_ThreadProc+0x71

I don't think we've had the renderer deadlock come through nvwgf2umx_cfg!cask::SafeEnum<cask::md::Algorithm_ENUMCLASS_SCOPEWRAPPER>::operator=+ yet. Okay, well, I can't dedupe this then 😕

TGSAN commented 2 years ago

INTERESTING. This is a different deadlock. it's in SizeChanged, but it's decidedly not #12176. That issue is a crash in teardown. This is a deadlock?

main thread

0:000> k
 # Child-SP          RetAddr               Call Site
00 00000028`8fcfd268 00007ffb`d0944065     ntdll!ZwWaitForAlertByThreadId+0x14 [minkernel\ntdll\daytona\objfre\amd64\usrstubs.asm @ 4059] 
01 00000028`8fcfd270 00007ffb`d096005c     ntdll!RtlpWaitOnAddressWithTimeout+0x81 [minkernel\ntos\rtl\waitaddr.c @ 851] 
02 00000028`8fcfd2a0 00007ffb`d095c123     ntdll!RtlpWaitOnAddress+0xd8 [minkernel\ntos\rtl\waitaddr.c @ 1094] 
03 00000028`8fcfd310 00007ffb`cde66003     ntdll!RtlWaitOnAddress+0x13 [minkernel\ntos\rtl\waitaddr.c @ 946] 
04 00000028`8fcfd350 00007ffb`5b921ce5     KERNELBASE!WaitOnAddress+0x33 [minkernel\kernelbase\synch.c @ 2258] 
05 (Inline Function) --------`--------     Microsoft_Terminal_Control!til::atomic_wait+0x18 [C:\a\_work\1\s\src\inc\til\atomic.h @ 13] 
06 00000028`8fcfd390 00007ffb`5b921c74     Microsoft_Terminal_Control!til::ticket_lock::lock+0x61 [C:\a\_work\1\s\src\inc\til\ticket_lock.h @ 35] 
07 00000028`8fcfd3d0 00007ffb`5b98c65c     Microsoft_Terminal_Control!std::unique_lock<til::ticket_lock>::unique_lock<til::ticket_lock>+0x18 [C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\mutex @ 135] 
08 (Inline Function) --------`--------     Microsoft_Terminal_Control!Microsoft::Terminal::Core::Terminal::LockForWriting+0x11 [C:\a\_work\1\s\src\cascadia\TerminalCore\Terminal.cpp @ 963] 
09 00000028`8fcfd400 00007ffb`5b98c5c6     Microsoft_Terminal_Control!winrt::Microsoft::Terminal::Control::implementation::ControlCore::SizeChanged+0x5c [C:\a\_work\1\s\src\cascadia\TerminalControl\ControlCore.cpp @ 869] 
0a 00000028`8fcfd450 00007ffb`5b974b0a     Microsoft_Terminal_Control!winrt::impl::produce<winrt::Microsoft::Terminal::Control::implementation::ControlCore,winrt::Microsoft::Terminal::Control::IControlCore>::SizeChanged+0x16 [C:\a\_work\1\s\src\cascadia\TerminalControl\Generated Files\winrt\Microsoft.Terminal.Control.h @ 1987] 
0b (Inline Function) --------`--------     Microsoft_Terminal_Control!winrt::impl::consume_Microsoft_Terminal_Control_IControlCore<winrt::Microsoft::Terminal::Control::IControlCore>::SizeChanged+0x17 [C:\a\_work\1\s\src\cascadia\TerminalControl\Generated Files\winrt\Microsoft.Terminal.Control.h @ 200] 
0c (Inline Function) --------`--------     Microsoft_Terminal_Control!winrt::Microsoft::Terminal::Control::implementation::TermControl::_SwapChainSizeChanged+0x25705 [C:\a\_work\1\s\src\cascadia\TerminalControl\TermControl.cpp @ 1688] 
0d (Inline Function) --------`--------     Microsoft_Terminal_Control!winrt::Microsoft::Terminal::Control::implementation::TermControlT<winrt::Microsoft::Terminal::Control::implementation::TermControl>::Connect::__l14::<lambda_22>::operator()+0x2571a [C:\a\_work\1\s\src\cascadia\TerminalControl\Generated Files\TermControl.xaml.g.hpp @ 232] 
0e 00000028`8fcfd480 00007ffb`c7b547a4     Microsoft_Terminal_Control!winrt::impl::delegate<winrt::Windows::UI::Xaml::SizeChangedEventHandler,`winrt::Microsoft::Terminal::Control::implementation::TermControlT<winrt::Microsoft::Terminal::Control::implementation::TermControl>::Connect'::`14'::<lambda_22> >::Invoke+0x2573a [C:\a\_work\1\s\src\cascadia\TerminalControl\Generated Files\winrt\Windows.UI.Xaml.h @ 4682] 
0f 00000028`8fcfd4d0 00007ffb`c7b544ea     

but the renderer thread is

  52  Id: 7fec.7530 Suspend: 0 Teb: 00000028`8fa36000 Unfrozen "Rendering Output Thread"
 # Child-SP          RetAddr               Call Site
00 00000028`9139ed48 00007ffb`cde29b5e     ntdll!ZwWaitForSingleObject+0x14 [minkernel\ntdll\daytona\objfre\amd64\usrstubs.asm @ 251] 
01 00000028`9139ed50 00007ffb`c0cef676     KERNELBASE!WaitForSingleObjectEx+0x8e [minkernel\kernelbase\synch.c @ 1328] 
02 00000028`9139edf0 00007ffb`c0cf0700     nvwgf2umx_cfg!cask::SafeEnum<cask::md::Algorithm_ENUMCLASS_SCOPEWRAPPER>::operator=+0xa1fe6
03 00000028`9139f370 00007ffb`c0cf2578     nvwgf2umx_cfg!cask::SafeEnum<cask::md::Algorithm_ENUMCLASS_SCOPEWRAPPER>::operator=+0xa3070
04 00000028`9139f3a0 00007ffb`c0ce8bc3     nvwgf2umx_cfg!cask::SafeEnum<cask::md::Algorithm_ENUMCLASS_SCOPEWRAPPER>::operator=+0xa4ee8
05 00000028`9139f3f0 00007ffb`ca0576f7     nvwgf2umx_cfg!cask::SafeEnum<cask::md::Algorithm_ENUMCLASS_SCOPEWRAPPER>::operator=+0x9b533
06 (Inline Function) --------`--------     d3d11!CResource<ID3D11Texture2D1>::CLS::FinalRelease+0x63 [onecoreuap\windows\directx\dxg\d3d11\D3DCore\Inc\Resource.inl @ 1460] 
07 00000028`9139f430 00007ffb`ca05dce4     d3d11!TCLSWrappers<CTexture2D>::CLSDestroy+0x87 [onecoreuap\windows\directx\dxg\d3d11\Common\Inc\D3D11Layered.hpp @ 225] 
08 (Inline Function) --------`--------     d3d11!CCLSFinalReleaseSentinel<CContext>::{dtor}+0x9 [onecoreuap\windows\directx\dxg\d3d11\Common\Inc\D3D11Layered.inl @ 347] 
09 (Inline Function) --------`--------     d3d11!CLayeredObjectWithCLS<CTexture2D>::{dtor}+0x1e [onecoreuap\windows\directx\dxg\d3d11\Common\Inc\D3D11Layered.inl @ 440] 
0a 00000028`9139f460 00007ffb`ca0611f9     d3d11!CLayeredObjectWithCLS<CTexture2D>::Release+0x24 [onecoreuap\windows\directx\dxg\d3d11\Common\Inc\D3D11Layered.inl @ 453] 
0b (Inline Function) --------`--------     d3d11!ATL::AtlComPtrAssign+0x17 [onecore\external\sdk\inc\atlmfc\atlcomcli.h @ 58] 
0c (Inline Function) --------`--------     d3d11!ATL::CComPtr<ID3D11LayeredUseCounted>::operator=+0x20 [onecore\external\sdk\inc\atlmfc\atlcomcli.h @ 267] 
0d (Inline Function) --------`--------     d3d11!CD3D11LayeredChild<ID3D11DeviceChild,NDXGI::CDevice,64>::FinalRelease+0x20 [onecoreuap\windows\directx\dxg\d3d11\Common\Inc\D3D11Layered.inl @ 254] 
0e 00000028`9139f490 00007ffb`ca05fda3     d3d11!NDXGI::CDeviceChild<IDXGIResource1,IDXGISwapChainInternal>::FinalRelease+0x29 [onecoreuap\windows\directx\dxg\d3d11\D3DCore\Inc\DXGIDevice.inl @ 999] 
0f (Inline Function) --------`--------     d3d11!NDXGI::CResource::FinalRelease+0x2b [onecoreuap\windows\directx\dxg\d3d11\D3DCore\Inc\DXGIResource.inl @ 410] 
10 (Inline Function) --------`--------     d3d11!CLayeredObject<NDXGI::CResource>::{dtor}+0x39 [onecoreuap\private\windows\inc\directx\dxg\Layered.inl @ 125] 
11 00000028`9139f4c0 00007ffb`ca06fe29     d3d11!CLayeredObject<NDXGI::CResource>::Release+0x43 [onecoreuap\private\windows\inc\directx\dxg\Layered.inl @ 139] 
12 00000028`9139f4f0 00007ffb`ca040051     d3d11!ATL::AtlComPtrAssign+0x39 [onecore\external\sdk\inc\atlmfc\atlcomcli.h @ 59] 
13 (Inline Function) --------`--------     d3d11!ATL::CComPtr<ID3D11LayeredUseCounted>::operator=+0xd [onecore\external\sdk\inc\atlmfc\atlcomcli.h @ 267] 
14 00000028`9139f520 00007ffb`ca03eabc     d3d11!NOutermost::CDeviceChild::FinalRelease+0x39 [onecoreuap\windows\directx\dxg\d3d11\D3DCore\Inc\Outermost.inl @ 822] 
15 (Inline Function) --------`--------     d3d11!CDelegatingUseCountedObject<NOutermost::CDeviceChild>::FinalRelease+0x5 [onecoreuap\windows\directx\dxg\d3d11\D3DCore\Inc\Outermost.inl @ 560] 
16 00000028`9139f550 00007ffb`ca03ea84     d3d11!CDelegatingUseCountedObject<NOutermost::CDeviceChild>::~CDelegatingUseCountedObject<NOutermost::CDeviceChild>+0x18 [onecoreuap\windows\directx\dxg\d3d11\D3DCore\Inc\Outermost.inl @ 568] 
17 00000028`9139f580 00007ffb`ca0404dd     d3d11!CDelegatingUseCountedObject<NOutermost::CDeviceChild>::`scalar deleting destructor'+0x14
18 (Inline Function) --------`--------     d3d11!CDelegatingUseCountedObject<NOutermost::CDeviceChild>::Delete+0x1f [onecoreuap\windows\directx\dxg\d3d11\D3DCore\Inc\Outermost.inl @ 648] 
19 00000028`9139f5b0 00007ffb`cb52a89c     d3d11!CDelegatingUseCountedObject<NOutermost::CDeviceChild>::UCDestroy+0x2d [onecoreuap\windows\directx\dxg\d3d11\D3DCore\Inc\Outermost.inl @ 613] 
1a 00000028`9139f5e0 00007ffb`cb52a7c5     dxgi!CDXGISwapChain::DestroyOwnedBuffer+0x6c [onecoreuap\windows\directx\dxg\dxgi\dll\swapchan.cpp @ 1689] 
1b 00000028`9139f610 00007ffb`cb534080     dxgi!CDXGISwapChain::DestroyBackBuffers+0x65 [onecoreuap\windows\directx\dxg\dxgi\dll\swapchan.cpp @ 1636] 
1c 00000028`9139f640 00007ffb`cb533e78     dxgi!CDXGISwapChain::ScenarioResizeBuffers+0x64 [onecoreuap\windows\directx\dxg\dxgi\dll\swapchan.cpp @ 8697] 
1d 00000028`9139f720 00007ffb`5b967e17     dxgi!CDXGISwapChain::ResizeBuffers+0x168 [onecoreuap\windows\directx\dxg\dxgi\dll\swapchan.cpp @ 7327] 
1e 00000028`9139f890 00007ffb`5b916530     Microsoft_Terminal_Control!Microsoft::Console::Render::DxEngine::StartPaint+0x47817 [C:\a\_work\1\s\src\renderer\dx\DxRenderer.cpp @ 1315] 
1f 00000028`9139f9b0 00007ffb`5b9162ba     Microsoft_Terminal_Control!Microsoft::Console::Render::Renderer::_PaintFrameForEngine+0x7c [C:\a\_work\1\s\src\renderer\base\renderer.cpp @ 121] 
20 00000028`9139fa50 00007ffb`5b916221     Microsoft_Terminal_Control!Microsoft::Console::Render::Renderer::PaintFrame+0x4a [C:\a\_work\1\s\src\renderer\base\renderer.cpp @ 78] 
21 00000028`9139fa80 00007ffb`cfd5244d     Microsoft_Terminal_Control!Microsoft::Console::Render::RenderThread::_ThreadProc+0x71

I don't think we've had the renderer deadlock come through nvwgf2umx_cfg!cask::SafeEnum<cask::md::Algorithm_ENUMCLASS_SCOPEWRAPPER>::operator=+ yet. Okay, well, I can't dedupe this then 😕

When I was documenting this issue, I may have actually had a deadlock after disconnecting from the RDP (unable to select the terminal text via the mouse pointer) and I ended up modifying the window size. I'm not sure if this action is what caused the SizeChanged to become deadlocked.

My steps:

  1. Disconnect the RDP connection
  2. wait for a while
  3. reconnect to RDP
  4. found that the stdout output of the terminal is no longer updated
  5. tried to select the terminal text with the mouse pointer, found no response
  6. tried to change the window size, but the word "not responding" appeared
MatthewSteeples commented 2 years ago

I can reliably reproduce this one as well. I don't know if it's significant but I believe that the DPI of my devices is different

zadjii-msft commented 2 years ago

Folks that are seeing this reliably - can you try out Terminal Preview 1.16 with the new atlas renderer enabled, and check if this still repros the same?

They have different renderer paths, so it might alleviate this issue. You can install Terminal Preview side-by-side with Terminal (stable), so don't worry about being on Preview permanently.

MihaZupan commented 1 year ago

I ran into the same issue and can no longer reproduce it with the v1.16.264 preview, thanks!

megapro17 commented 1 year ago

Unreleated, but i had the same hang after rdp with google chrome. Reinstalling win seems fixed it

lhecker commented 1 year ago

This will most likely be fixed by #14959 because it doesn't call any graphics APIs while the console lock is being held.

zadjii-msft commented 1 year ago

Anyone still seeing this on 1.18 Stable & 1.19 Preview/?

zadjii-msft commented 1 year ago

@megapro17 Hey since you're bumping this thread, does that mean you're seeing this on 1.18/1.19? Which version exactly?

Honestly if you are, it might be best to start a new thread about this. Our locking has changed substantially over 1.18&19, and I wouldn't expect the stacks from before to still be relevant. We'd probably need a new stack trace.

microsoft-github-policy-service[bot] commented 1 year ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.