terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Broadcast Exit to multiple panes crash

Open KruseCtrl opened this issue 1 year ago • 5 comments

Windows Terminal version

1.22.2702.0_x64

Windows build number

10.0.22631.4317

Other Software

No response

Steps to reproduce

  1. Open the Windows Terminal Preview
  2. Create a second pane.
  3. Toggle broadcast input to all panes (you should now be able to type in all panes)
  4. Press Ctrl + D or type "exit"
  5. the terminal crashes, even if you have other tabs open.

Expected Behavior

I'd expect it to exit out of the tab, so that if you have other tabs you can return to using them.

Actual Behavior

Upon exiting with multiple panes at the same time, it crashes and the program shuts down.

KruseCtrl avatar Oct 17 '24 10:10 KruseCtrl

Can I have a look into it? @KruseCtrl

PriyanshSrivastava0305 avatar Oct 17 '24 11:10 PriyanshSrivastava0305

@PriyanshSrivastava0305 I see that you've left this comment on multiple issues. I appreciate your enthusiasm! Just so you know: you do not need permission from the person who filed a bug--nor do you need to @-mention them--to start working on something.

Feel free to submit a pull request whenever it's ready. Otherwise, feel free to investigate bugs and leave the actual notes from your investigations in the comment history.

Otherwise, posting comments like this in every issue just generates spam mail for everyone to filter out.

DHowett avatar Oct 17 '24 15:10 DHowett

I wonder if this isn't from a similar root cause to #18049 (maybe #18086 too)

zadjii-msft avatar Oct 24 '24 18:10 zadjii-msft

Interesting. I couldn't repro this with 1.21.2911.0. HOWEVER, I could repro it on 1.22.2912.0 with closeOnExit: never, and then pressing ^D to actually close the panes.

[0x0]   TerminalApp!std::_Ptr_base<Pane>::_Construct_from_weak   (Inline Function)   (Inline Function)   
[0x1]   TerminalApp!std::shared_ptr<Pane>::{ctor}+0x5   (Inline Function)   (Inline Function)   
[0x2]   TerminalApp!std::enable_shared_from_this<Pane>::shared_from_this+0x5   (Inline Function)   (Inline Function)   
[0x3]   TerminalApp!Pane::WalkTree<`Pane::BroadcastChar'::`2'::<lambda_1> >+0x32   0x5897b1de40   0x7fff94f18653   
[0x4]   TerminalApp!Pane::WalkTree<`Pane::BroadcastChar'::`2'::<lambda_1> >+0x1b3   0x5897b1def0   0x7fff94f3676b   
[0x5]   TerminalApp!Pane::BroadcastChar+0x3c   (Inline Function)   (Inline Function)   
[0x6]   TerminalApp!`winrt::TerminalApp::implementation::TerminalTab::_addBroadcastHandlers'::`2'::<lambda_2>::operator()<winrt::Windows::Foundation::IInspectable const &,winrt::Microsoft::Terminal::Control::CharSentEventArgs const &>+0x1fb   0x5897b1dfa0   0x7fff94f36561   
[0x7]   TerminalApp!winrt::impl::delegate<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Microsoft::Terminal::Control::CharSentEventArgs>,`winrt::TerminalApp::implementation::TerminalTab::_addBroadcastHandlers'::`2'::<lambda_2> >::Invoke+0x21   0x5897b1e080   0x7fff948bfd94   
[0x8]   Microsoft_Terminal_Control!winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Microsoft::Terminal::Control::CharSentEventArgs>::operator()+0x3b   (Inline Function)   (Inline Function)   
[0x9]   Microsoft_Terminal_Control!winrt::impl::invoke<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Microsoft::Terminal::Control::CharSentEventArgs>,winrt::Microsoft::Terminal::Control::implementation::TermControl,winrt::Microsoft::Terminal::Control::CharSentEventArgs>+0xb4   0x5897b1e0b0   0x7fff948a043f   
[0xa]   Microsoft_Terminal_Control!winrt::event<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Microsoft::Terminal::Control::CharSentEventArgs> >::operator()+0x49   (Inline Function)   (Inline Function)   
[0xb]   Microsoft_Terminal_Control!til::typed_event<winrt::Windows::Foundation::IInspectable,winrt::Microsoft::Terminal::Control::CharSentEventArgs>::raise+0x49   (Inline Function)   (Inline Function)   
[0xc]   Microsoft_Terminal_Control!winrt::Microsoft::Terminal::Control::implementation::TermControl::_CharacterHandler+0x18f   0x5897b1e100   0x7fff948e862c   
[0xd]   Microsoft_Terminal_Control!winrt::Microsoft::Terminal::Control::implementation::TermControlT<winrt::Microsoft::Terminal::Control::implementation::TermControl>::Connect::__l5::<lambda_1>::operator()+0x4e   (Inline Function)   (Inline Function)   
[0xe]   Microsoft_Terminal_Control!winrt::impl::delegate<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::UI::Xaml::UIElement,winrt::Windows::UI::Xaml::Input::CharacterReceivedRoutedEventArgs>,`winrt::Microsoft::Terminal::Control::implementation::TermControlT<winrt::Microsoft::Terminal::Control::implementation::TermControl>::Connect'::`5'::<lambda_1> >::Invoke+0x6c   0x5897b1e1b0   0x7ff82268cc0f   
[0xf]   Windows_UI_Xaml!DirectUI::CRoutedEventSourceBase<DirectUI::IUntypedEventSource,Windows::Foundation::ITypedEventHandler<Windows::UI::Xaml::UIElement *,Windows::UI::Xaml::Input::CharacterReceivedRoutedEventArgs *>,Windows::UI::Xaml::IUIElement,Windows::UI::Xaml::Input::ICharacterReceivedRoutedEventArgs>::Raise+0x11b   0x5897b1e200   0x7ff82268ca33   
[0x10]   Windows_UI_Xaml!DirectUI::CRoutedEventSourceBase<DirectUI::IUntypedEventSource,Windows::Foundation::ITypedEventHandler<Windows::UI::Xaml::UIElement *,Windows::UI::Xaml::Input::CharacterReceivedRoutedEventArgs *>,Windows::UI::Xaml::IUIElement,Windows::UI::Xaml::Input::ICharacterReceivedRoutedEventArgs>::UntypedRaise+0x43   0x5897b1e2a0   0x7ff82231d637   
[0x11]   Windows_UI_Xaml!DirectUI::DependencyObject::FireEvent+0x8a   (Inline Function)   (Inline Function)   
[0x12]   Windows_UI_Xaml!DirectUI::DXamlCore::FireEvent+0x33a   (Inline Function)   (Inline Function)   



https://github.com/microsoft/terminal/blob/24475acba845c2f2bf24d58245470d66ef487164/src/cascadia/TerminalApp/Pane.cpp#L3009-L3023

https://github.com/microsoft/terminal/blob/24475acba845c2f2bf24d58245470d66ef487164/src/cascadia/TerminalApp/Pane.h#L170-L184

Looks like the pane probably got released while we were doing that WalkTree

zadjii-msft avatar Oct 24 '24 20:10 zadjii-msft

I'm also seeing this with 1.23.10353.0 (see https://youtu.be/K0vEnnK4dTA).

If it makes a difference we use Git Bash as our default terminal profile and in this example I have SSH'd to several EC2 that I render in terminal panes that I am broadcasting my exit to.

botscholar-scott avatar Feb 07 '25 23:02 botscholar-scott