Entire Terminal app is randomly crashing while closing tabs #14294

Closed
opened 2026-01-31 04:06:26 +00:00 by claunia · 10 comments
Owner

Originally created by @pjakuszew on GitHub (Jun 22, 2021).

Originally assigned to: @lhecker on GitHub.

Windows Terminal version (or Windows build number)

1.8.1521.0

Other Software

No response

Steps to reproduce

  1. Set WSL profile as default one
  2. Open a lot of tabs with Ctrl+Shift+T
  3. Start closing them with Ctrl+D

Expected Behavior

Tabs should either close, or tab contents should end with Process exited with code XXXXXX

Actual Behavior

Whole Terminal app is crashing, with all sessions that were running inside it. I'm seeing this behavior on two separate machines.

It is happening randomly, most of the time it works correctly, but I had a couple of situations where entire Terminal crashed while I was doing more important things :(

This is WSL profile I have on my laptop, the other one has no theme or font settings.

           {
                "bellStyle": "none",
                "closeOnExit": "graceful",
                "colorScheme": "One Half Dark",
                "cursorShape": "filledBox",
                "fontFace": "Terminus (TTF) for Windows",
                "fontSize": 9,
                "guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
                "hidden": false,
                "historySize": 50000,
                "name": "Ubuntu-20.04",
                "source": "Windows.Terminal.Wsl",
                "startingDirectory": "\\\\wsl$\\Ubuntu-20.04\\home\\patryk",
                "useAcrylic": false
            }
Originally created by @pjakuszew on GitHub (Jun 22, 2021). Originally assigned to: @lhecker on GitHub. ### Windows Terminal version (or Windows build number) 1.8.1521.0 ### Other Software _No response_ ### Steps to reproduce 1. Set WSL profile as default one 2. Open a lot of tabs with Ctrl+Shift+T 3. Start closing them with Ctrl+D ### Expected Behavior Tabs should either close, or tab contents should end with `Process exited with code XXXXXX` ### Actual Behavior Whole Terminal app is crashing, with all sessions that were running inside it. I'm seeing this behavior on two separate machines. It is happening randomly, most of the time it works correctly, but I had a couple of situations where entire Terminal crashed while I was doing more important things :( This is WSL profile I have on my laptop, the other one has no theme or font settings. ``` { "bellStyle": "none", "closeOnExit": "graceful", "colorScheme": "One Half Dark", "cursorShape": "filledBox", "fontFace": "Terminus (TTF) for Windows", "fontSize": 9, "guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}", "hidden": false, "historySize": 50000, "name": "Ubuntu-20.04", "source": "Windows.Terminal.Wsl", "startingDirectory": "\\\\wsl$\\Ubuntu-20.04\\home\\patryk", "useAcrylic": false } ```
Author
Owner

@skyline75489 commented on GitHub (Jun 22, 2021):

This feels like #3915

@skyline75489 commented on GitHub (Jun 22, 2021): This feels like #3915
Author
Owner

@pjakuszew commented on GitHub (Jun 22, 2021):

I don't think this is the same issue - if I open multiple Terminal instances, only single instances will crash, not all of them.

@pjakuszew commented on GitHub (Jun 22, 2021): I don't think this is the same issue - if I open multiple Terminal instances, only single instances will crash, not all of them.
Author
Owner

@pjakuszew commented on GitHub (Jun 22, 2021):

Here is a screen recording which shows the problem happening on separate Terminal instances: https://drive.google.com/file/d/1eUrnRetknILgl08hQoy0yHyAPvAQiLkV/view?usp=sharing

@pjakuszew commented on GitHub (Jun 22, 2021): Here is a screen recording which shows the problem happening on separate Terminal instances: https://drive.google.com/file/d/1eUrnRetknILgl08hQoy0yHyAPvAQiLkV/view?usp=sharing
Author
Owner

@pjakuszew commented on GitHub (Jun 22, 2021):

Also, I just installed Visual Studio, ran the Terminal under debugger and it crashed with following error:

Exception thrown at 0x00007FF8C90F2CD0 (Microsoft.Terminal.Control.dll) in WindowsTerminal.exe: 0xC0000005: Access violation writing location 0x0000000000000060.

I'm currently installing the components needed to build the Terminal app, I will try to get more details from Debug build.

@pjakuszew commented on GitHub (Jun 22, 2021): Also, I just installed Visual Studio, ran the Terminal under debugger and it crashed with following error: ``` Exception thrown at 0x00007FF8C90F2CD0 (Microsoft.Terminal.Control.dll) in WindowsTerminal.exe: 0xC0000005: Access violation writing location 0x0000000000000060. ``` I'm currently installing the components needed to build the Terminal app, I will try to get more details from Debug build.
Author
Owner

@j4james commented on GitHub (Jun 22, 2021):

See also issue #10302. There are a number of people in that thread using the same version as you who have reported the app crashing when tabs are closed.

@j4james commented on GitHub (Jun 22, 2021): See also issue #10302. There are a number of people in that thread using the same version as you who have reported the app crashing when tabs are closed.
Author
Owner

@pjakuszew commented on GitHub (Jun 23, 2021):

Yes, #10302 looks similiar to my problem described here.

I had some difficulties with building the Terminal app and I'm still trying to figure out how to produce some meaningful output that would help with troubleshooting this.

This is what I currently have, when running a debug build from release-1.8 branch - this exception happens after doing the steps described in issue description:

image

@pjakuszew commented on GitHub (Jun 23, 2021): Yes, #10302 looks similiar to my problem described here. I had some difficulties with building the Terminal app and I'm still trying to figure out how to produce some meaningful output that would help with troubleshooting this. This is what I currently have, when running a debug build from release-1.8 branch - this exception happens after doing the steps described in issue description: ![image](https://user-images.githubusercontent.com/6403607/123013771-1f2d1b80-d3c5-11eb-91c8-75099cc223e2.png)
Author
Owner

@lhecker commented on GitHub (Jul 2, 2021):

@pjakuszew Your screenshot above is actually extremely valuable, you have no idea... Thanks!
Given the 0x60 byte offset to an atomic from what's clearly a null pointer, inside exchange(), this is obviously (I'm kidding) a ThrottledFunc instance. gg ez 😎

The crash occurs here: 6617eb33ac/src/cascadia/TerminalControl/TermControl.cpp (L2547-L2550)

  • null pointer check missing in the 1.8 branch ("fixed" in 1.9)
  • both in 1.8 and 1.9 the CursorPositionChanged functions will be invoked from background threads --> thread safe deallocation missing == race condition == crash on certain CPUs, but not the ones the terminal team uses, because cache invalidation is weird and unpredictable
@lhecker commented on GitHub (Jul 2, 2021): @pjakuszew Your screenshot above is actually extremely valuable, you have no idea... Thanks! Given the 0x60 byte offset to an atomic from what's clearly a null pointer, inside `exchange()`, this is _obviously_ (I'm kidding) a `ThrottledFunc` instance. gg ez 😎 The crash occurs here: https://github.com/microsoft/terminal/blob/6617eb33ac640fcebad520bd94e53c11cf2e05fe/src/cascadia/TerminalControl/TermControl.cpp#L2547-L2550 * null pointer check missing in the 1.8 branch ("fixed" in 1.9) * both in 1.8 and 1.9 the `CursorPositionChanged` functions will be invoked from background threads --> thread safe deallocation missing == race condition == crash on certain CPUs, but not the ones the terminal team uses, because cache invalidation is weird and unpredictable
Author
Owner

@pjakuszew commented on GitHub (Jul 2, 2021):

I'm glad to hear it was actually helpful! Thanks for looking into this :)

@pjakuszew commented on GitHub (Jul 2, 2021): I'm glad to hear it was actually helpful! Thanks for looking into this :)
Author
Owner

@ghost commented on GitHub (Jul 14, 2021):

:tada:This issue was addressed in #10549, which has now been successfully released as Windows Terminal v1.9.1942.0.🎉

Handy links:

@ghost commented on GitHub (Jul 14, 2021): :tada:This issue was addressed in #10549, which has now been successfully released as `Windows Terminal v1.9.1942.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.9.1942.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Author
Owner

@ghost commented on GitHub (Jul 14, 2021):

:tada:This issue was addressed in #10549, which has now been successfully released as Windows Terminal Preview v1.10.1933.0.🎉

Handy links:

@ghost commented on GitHub (Jul 14, 2021): :tada:This issue was addressed in #10549, which has now been successfully released as `Windows Terminal Preview v1.10.1933.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.10.1933.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#14294