Heap Corruption (0xc0000374) crash when closing terminal window #22667

Closed
opened 2026-01-31 08:20:01 +00:00 by claunia · 10 comments
Owner

Originally created by @bondobrus on GitHub (Dec 14, 2024).

Originally assigned to: @lhecker on GitHub.

Windows Terminal version

1.21.3231.0

Windows build number

10.0.26100.0

Other Software

No response

Steps to reproduce

  1. Using Windows Terminal
  2. Close terminal window
  3. Terminal crashes during shutdown with heap corruption error

Expected Behavior

Windows Terminal should close cleanly without any crashes.

Actual Behavior

Terminal crashes during shutdown with heap corruption error (0xc0000374).

Crash analysis from dump file shows:

Error Code: 0xc0000374 (Heap Corruption)
FAILURE_BUCKET_ID: HEAP_CORRUPTION_c0000374_ucrtbase.dll!_free_base
Crash occurs during UI cleanup (TabView, ScrollView components)
Stack trace indicates the issue happens during memory deallocation in ucrtbase.dll

Full stack trace and crash dump analysis:

STACK_COMMAND:  ~93s; .ecxr ; kb
FAILURE_BUCKET_ID:  HEAP_CORRUPTION_c0000374_ucrtbase.dll!_free_base
OS_VERSION:  10.0.22621.1
IMAGE_VERSION:  10.0.22621.3593

The crash consistently happens during the cleanup phase when closing the terminal window, specifically when deallocating UI components' memory.

Originally created by @bondobrus on GitHub (Dec 14, 2024). Originally assigned to: @lhecker on GitHub. ### Windows Terminal version 1.21.3231.0 ### Windows build number 10.0.26100.0 ### Other Software _No response_ ### Steps to reproduce 1. Using Windows Terminal 2. Close terminal window 3. Terminal crashes during shutdown with heap corruption error ### Expected Behavior Windows Terminal should close cleanly without any crashes. ### Actual Behavior Terminal crashes during shutdown with heap corruption error (0xc0000374). Crash analysis from dump file shows: Error Code: 0xc0000374 (Heap Corruption) FAILURE_BUCKET_ID: HEAP_CORRUPTION_c0000374_ucrtbase.dll!_free_base Crash occurs during UI cleanup (TabView, ScrollView components) Stack trace indicates the issue happens during memory deallocation in ucrtbase.dll Full stack trace and crash dump analysis: ``` STACK_COMMAND: ~93s; .ecxr ; kb FAILURE_BUCKET_ID: HEAP_CORRUPTION_c0000374_ucrtbase.dll!_free_base OS_VERSION: 10.0.22621.1 IMAGE_VERSION: 10.0.22621.3593 ``` The crash consistently happens during the cleanup phase when closing the terminal window, specifically when deallocating UI components' memory.
claunia added the Needs-TriageIssue-BugNeeds-Attention labels 2026-01-31 08:20:02 +00:00
Author
Owner

@lhecker commented on GitHub (Dec 17, 2024):

Do you happen to have a dump file as well? If not, this wiki page explains how to get them: https://github.com/microsoft/terminal/wiki/Troubleshooting-Tips

@lhecker commented on GitHub (Dec 17, 2024): Do you happen to have a dump file as well? If not, this wiki page explains how to get them: https://github.com/microsoft/terminal/wiki/Troubleshooting-Tips
Author
Owner

@bondobrus commented on GitHub (Dec 17, 2024):

Yes, I've sent the dump file via email to @zadjii-msft
Thank you.

@bondobrus commented on GitHub (Dec 17, 2024): Yes, I've sent the dump file via email to @zadjii-msft Thank you.
Author
Owner

@carlos-zamora commented on GitHub (Dec 18, 2024):

Thanks @bondobrus! We've got the dump file. Now just a matter of taking a look at it. Most of the team is already on vacation for the holidays though, so chances are we won't be able to take a look at it until the new year.

We recommend you try out WT Preview or even WT Canary in the meantime.

@carlos-zamora commented on GitHub (Dec 18, 2024): Thanks @bondobrus! We've got the dump file. Now just a matter of taking a look at it. Most of the team is already on vacation for the holidays though, so chances are we won't be able to take a look at it until the new year. We recommend you try out [WT Preview](https://apps.microsoft.com/detail/9N8G5RFZ9XK3?hl=en-us&gl=US&ocid=pdpshare) or even [WT Canary](https://github.com/microsoft/terminal#installing-windows-terminal-canary) in the meantime.
Author
Owner

@bondobrus commented on GitHub (Jan 2, 2025):

Thanks @bondobrus! We've got the dump file. Now just a matter of taking a look at it. Most of the team is already on vacation for the holidays though, so chances are we won't be able to take a look at it until the new year.

We recommend you try out WT Preview or even WT Canary in the meantime.

Unfortunately, on Windows Terminal Preview same issue occurs.

@bondobrus commented on GitHub (Jan 2, 2025): > Thanks [@bondobrus](https://github.com/bondobrus)! We've got the dump file. Now just a matter of taking a look at it. Most of the team is already on vacation for the holidays though, so chances are we won't be able to take a look at it until the new year. > > We recommend you try out [WT Preview](https://apps.microsoft.com/detail/9N8G5RFZ9XK3?hl=en-us&gl=US&ocid=pdpshare) or even [WT Canary](https://github.com/microsoft/terminal#installing-windows-terminal-canary) in the meantime. Unfortunately, on Windows Terminal Preview same issue occurs.
Author
Owner

@lhecker commented on GitHub (Jan 15, 2025):

I looked at it, but unfortunately, I was unable to figure out where the heap corruption originated from. Maybe I missed something...

Could you try using our Canary version for a while and see if it reproduces? You can find it here: https://aka.ms/terminal-canary-installer
Upon first launch it'll copy the settings from the stable version of Windows Terminal. It'll also cleanly uninstall again. It contains a rewrite of our windowing code which should theoretically make it more robust on shutdown.

@lhecker commented on GitHub (Jan 15, 2025): I looked at it, but unfortunately, I was unable to figure out where the heap corruption originated from. Maybe I missed something... Could you try using our Canary version for a while and see if it reproduces? You can find it here: https://aka.ms/terminal-canary-installer Upon first launch it'll copy the settings from the stable version of Windows Terminal. It'll also cleanly uninstall again. It contains a rewrite of our windowing code which should theoretically make it more robust on shutdown.
Author
Owner

@bondobrus commented on GitHub (Jan 16, 2025):

I will try with that thanks, if same scenario will occurs I will reply.

@bondobrus commented on GitHub (Jan 16, 2025): I will try with that thanks, if same scenario will occurs I will reply.
Author
Owner

@bondobrus commented on GitHub (Jan 17, 2025):

For now I haven't noticed crashing during shutdown but surely that's not enough amount of time. What I've noticed is sometimes cursor disappears while it is on terminal canary window.

@bondobrus commented on GitHub (Jan 17, 2025): For now I haven't noticed crashing during shutdown but surely that's not enough amount of time. What I've noticed is sometimes cursor disappears while it is on terminal canary window.
Author
Owner

@lhecker commented on GitHub (Jan 17, 2025):

The cursor disappearing is a known issue which I'll be fixing soon.

@lhecker commented on GitHub (Jan 17, 2025): The cursor disappearing is a known issue which I'll be fixing soon.
Author
Owner

@bondobrus commented on GitHub (Jan 22, 2025):

Some time passed I can confirm in canary edition terminal don't crash for me on shutdown

@bondobrus commented on GitHub (Jan 22, 2025): Some time passed I can confirm in canary edition terminal don't crash for me on shutdown
Author
Owner

@DHowett commented on GitHub (Jan 23, 2025):

Thanks!

@DHowett commented on GitHub (Jan 23, 2025): Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22667