Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminal Canary crashes when i merge a tab to another window #17246

Open
AvogatoWizardWhisker opened this issue May 10, 2024 · 7 comments
Open
Labels
Area-Windowing Window frame, quake mode, tearout Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal. Severity-Crash Crashes are real bad news.

Comments

@AvogatoWizardWhisker
Copy link

Windows Terminal version

1.22.1301.0

Windows build number

10.0.26212.5000

Other Software

No response

Steps to reproduce

  1. Open two Windows Terminal windows
  2. Drag a tab from the first window and drop to the second window
Recording.2024-05-10.210951.mp4

Expected Behavior

I was expecting the dropped tabs to successfully merge with the first window without hangs or crash.

Actual Behavior

Two strange scenarios happen: Either the first window hangs but I successfully dropped the tab to the second window, or the entire Terminal hangs then crashes.

This doesn't always happen so I keep reproducing the bug. And according to Windows' Reliability History, the faulty module names were Windows.UI.Xaml.dll and Microsoft.Terminal.Control.dll
image
image

I wanted to use Windows Debugger, but I couldn't get anything useful. Maybe I don't have enough experience with it. I'm sorry about that.

@AvogatoWizardWhisker AvogatoWizardWhisker added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels May 10, 2024
Copy link

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@tusharsnx
Copy link
Contributor

tusharsnx commented May 12, 2024

For some reason closing or tearing off a tab leads to a call to OnCreateAutomationPeer on the TermControl of the next tab (the one receiving the focus after this tab is closed).

OnCreateAutomationPeer seems to originate from XAML:

image

In the case of a single tab terminal window, there is no next tab, so the same tab (being replaced) receives the call. Note that the tab being torn off gets into the "detached" mode and has no _interactivity associated with it. This results in the crash due to null pointer deref:

image

@AvogatoWizardWhisker
Copy link
Author

That makes sense after i ran Windows Debugger on Terminal Canary:

(e670.164b4): Windows Runtime Transform Error - code 40080202 (first chance)
(e670.164b4): C++ EH exception - code e06d7363 (first chance)
onecoreuap\windows\frameworkudk\warppal.cpp(783)\Microsoft.Internal.WarpPal.dll!00007FFA99D0EE4C: (caller: 00007FFA9A1798EA) ReturnHr(4) tid(164b4) 80004002 No such interface supported
onecoreuap\windows\frameworkudk\warppal.cpp(783)\Microsoft.Internal.WarpPal.dll!00007FFA99D0EE4C: (caller: 00007FFA9A1798EA) ReturnHr(5) tid(164b4) 80004002 No such interface supported
onecoreuap\windows\frameworkudk\warppal.cpp(783)\Microsoft.Internal.WarpPal.dll!00007FFA99D0EE4C: (caller: 00007FFA9A1798EA) ReturnHr(6) tid(164b4) 80004002 No such interface supported
onecoreuap\windows\advcore\winrt\onecoreiwindow\corewindow\common\desktopwindowcontentbridge.cpp(540)\Windows.UI.dll!00007FFA89C2C507: (caller: 00007FFA89C2C681) ReturnHr(1) tid(164b4) 8007139F The group or resource is not in the correct state to perform the requested operation.
(e670.164b4): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
Windows_UI_Xaml!DirectUI::DXamlCore::EnsureDragDrop [inlined in Windows_UI_Xaml!<lambda_389d8a62991e0fa55478e04c88286937>::operator()+0xc8]:
00007ffa`895b2444 488b8058010000  mov     rax,qword ptr [rax+158h] ds:00000000`00000158=????????????????

@tusharsnx
Copy link
Contributor

tusharsnx commented May 13, 2024

Huh, this looks like it fails here:

Windows_UI_Xaml!DirectUI::DXamlCore::EnsureDragDrop [inlined in Windows_UI_Xaml!<lambda_389d8a62991e0fa55478e04c88286937>::operator()+0xc8]

And I can repro this even on #17251 branch. Maybe they are unrelated 🤔

After re-reading this from the first comment:

Two strange scenarios happen: Either the first window hangs but I successfully dropped the tab to the second window, or the entire Terminal hangs then crashes.

I believe there are two crash scenarios:

  1. Drag the only tab in the single-tab terminal window and drop it such that it creates a new window.
  2. Drag the only tab in the single-tab terminal window and drop it into any other terminal window to merge it with that window.

(1) is fatal, crashes the entire process taking down all the running terminal windows, and should be fixed by #17251. But (2) doesn't seem to crash the process or any running windows. You would only see the no-tab window to take a while before it disappears.

I'm going to unlink this issue from #17251 because it doesn't fix all the issues.

@brookst
Copy link

brookst commented May 14, 2024

Is this issue older than Canary?

I just had Terminal Preview (1.21.1272.0) crash when merging in a tab, though the reported versions don't seem to line up at all:

Faulting application name: WindowsTerminal.exe, version: 1.21.2405.6002, time stamp: 0x66396ac3
Faulting module name: Microsoft.Terminal.Control.dll, version: 1.21.2405.6002, time stamp: 0x66396908
Exception code: 0xc0000005
Fault offset: 0x00000000000f60c9
Faulting process ID: 0x0x18B8
Faulting application start time: 0x0x1DAA601207F96C8
Faulting application path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminalPreview_1.21.1272.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe
Faulting module path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminalPreview_1.21.1272.0_x64__8wekyb3d8bbwe\Microsoft.Terminal.Control.dll
Report ID: 2046127b-c89a-446d-9f22-77734d5137be
Faulting package full name: Microsoft.WindowsTerminalPreview_1.21.1272.0_x64__8wekyb3d8bbwe
Faulting package-relative application ID: App
Description
Faulting Application Path:	C:\Program Files\WindowsApps\Microsoft.WindowsTerminalPreview_1.21.1272.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe

Problem signature
Problem Event Name:	MoAppCrash
Package Full Name:	Microsoft.WindowsTerminalPreview_1.21.1272.0_x64__8wekyb3d8bbwe
Application Name:	praid:App
Application Version:	1.21.2405.6002
Application Timestamp:	66396ac3
Fault Module Name:	Windows.UI.Xaml.dll
Fault Module Version:	10.0.22621.3527
Fault Module Timestamp:	ac70373e
Exception Code:	c0000005
Exception Offset:	000000000041dc17
OS Version:	10.0.22631.2.0.0.768.101
Locale ID:	1033
Additional Information 1:	bee9
Additional Information 2:	bee97536ba640759fac0d38a6ed36481
Additional Information 3:	d7a5
Additional Information 4:	d7a5acd4c1813a34b6cf99e57e6ac9ba

Extra information about the problem
Bucket ID:	2b5e3f6ac22530ac49d0202c4830bf22 (1860022020665818914)

@zadjii-msft
Copy link
Member

I mean, canary and preview forked off like, last week, so I'd fully imagine that whatever the root cause of this is, it's in Preview too.

@AvogatoWizardWhisker
Copy link
Author

I tried to reproduce the issue again with Windows Debugger and that's what I got. However, this time, Terminal Canary just hangs, and it becomes unresponsive.

(540c.d828): Windows Runtime Transform Error - code 40080202 (first chance)
(540c.d828): C++ EH exception - code e06d7363 (first chance)
onecoreuap\windows\frameworkudk\warppal.cpp(783)\Microsoft.Internal.WarpPal.dll!00007FFF8881EE4C: (caller: 00007FFF89A598EA) ReturnHr(4) tid(d828) 80004002 No such interface supported
onecoreuap\windows\frameworkudk\warppal.cpp(783)\Microsoft.Internal.WarpPal.dll!00007FFF8881EE4C: (caller: 00007FFF89A598EA) ReturnHr(5) tid(d828) 80004002 No such interface supported
onecoreuap\windows\frameworkudk\warppal.cpp(783)\Microsoft.Internal.WarpPal.dll!00007FFF8881EE4C: (caller: 00007FFF89A598EA) ReturnHr(6) tid(d828) 80004002 No such interface supported
(540c.4ea8): Windows Runtime Transform Error - code 40080202 (first chance)
onecoreuap\windows\advcore\winrt\onecoreiwindow\corewindow\common\desktopwindowcontentbridge.cpp(540)\Windows.UI.dll!00007FFF7707C507: (caller: 00007FFF7707C681) ReturnHr(1) tid(d828) 8007139F The group or resource is not in the correct state to perform the requested operation.
(540c.d828): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
Microsoft_Terminal_Control!DllCanUnloadNow+0x37509:
00007ffe`897d6419 488b01          mov     rax,qword ptr [rcx] ds:00000000`00000000=????????????????```

@carlos-zamora carlos-zamora added Severity-Crash Crashes are real bad news. Product-Terminal The new Windows Terminal. Area-Windowing Window frame, quake mode, tearout and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels May 15, 2024
@carlos-zamora carlos-zamora added this to the Terminal v1.22 milestone May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Windowing Window frame, quake mode, tearout Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal. Severity-Crash Crashes are real bad news.
Projects
None yet
Development

No branches or pull requests

5 participants