Resizing a Terminal with retro terminal effects hangs the Terminal #7240

Open
opened 2026-01-31 00:58:44 +00:00 by claunia · 0 comments
Owner

Originally created by @zadjii-msft on GitHub (Apr 1, 2020).

Originally assigned to: @DHowett-MSFT on GitHub.

This is on the selfhost 0.11.912.0 release, but also repro'd on the last 0.11 preview. Unsure if it repros on earlier builds also.

Add the following to a profile:

"experimental.retroTerminalEffect": true

Then open a tab with that profile and try resizing the Terminal.

Expected

The Terminal should not hang.

Actual

It hangs 😢

Looks like we're waiting for the read lock at the top of TermControl::RenderEngineSwapChainChanged on the RenderThread. This is higher on the stack than Renderer::_PaintFrameForEngine, which I believe has a write lock. But it's the same thread, so we should be fine, right?

Oh no the main thread also is waiting on the write lock 😲

03 TerminalControl!std::unique_lock<std::shared_mutex>::{ctor}+0x8 
04 TerminalControl!Microsoft::Terminal::Core::Terminal::LockForWriting+0x14
05 TerminalControl!winrt::Microsoft::Terminal::TerminalControl::implementation::TermControl::_SwapChainSizeChanged+0x37
06 TerminalControl!winrt::Microsoft::Terminal::TerminalControl::implementation::TermControlT<winrt::Microsoft::Terminal::TerminalControl::implementation::TermControl>::Connect::__l10::<lambda_87fbcfa1739d624dde571db8710dac26>::operator()+0x77 

Wait no, that's fine. The main thread doesn't have the lock, it's just waiting for it. That's fine. I think the problem is the render thread can't seem to re-enter the lock

because it's a shared_mutex not a recursive_mutex

Originally created by @zadjii-msft on GitHub (Apr 1, 2020). Originally assigned to: @DHowett-MSFT on GitHub. This is on the selfhost 0.11.912.0 release, but also repro'd on the last 0.11 preview. Unsure if it repros on earlier builds also. Add the following to a profile: ```json "experimental.retroTerminalEffect": true ``` Then open a tab with that profile and try resizing the Terminal. ### Expected The Terminal should not hang. ### Actual It hangs 😢 Looks like we're waiting for the read lock at the top of `TermControl::RenderEngineSwapChainChanged` on the `RenderThread`. This is higher on the stack than `Renderer::_PaintFrameForEngine`, which I believe has a write lock. But it's the same thread, so we should be fine, right? Oh no the main thread also is waiting on the write lock 😲 ``` 03 TerminalControl!std::unique_lock<std::shared_mutex>::{ctor}+0x8 04 TerminalControl!Microsoft::Terminal::Core::Terminal::LockForWriting+0x14 05 TerminalControl!winrt::Microsoft::Terminal::TerminalControl::implementation::TermControl::_SwapChainSizeChanged+0x37 06 TerminalControl!winrt::Microsoft::Terminal::TerminalControl::implementation::TermControlT<winrt::Microsoft::Terminal::TerminalControl::implementation::TermControl>::Connect::__l10::<lambda_87fbcfa1739d624dde571db8710dac26>::operator()+0x77 ``` Wait no, that's fine. The main thread doesn't _have_ the lock, it's just waiting for it. That's fine. I think the problem is the render thread can't seem to re-enter the lock because it's a `shared_mutex` not a [`recursive_mutex`](https://en.cppreference.com/w/cpp/thread/recursive_mutex)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#7240