[PR #12181] [MERGED] Fix unbalanced unlock in PtySignalInputThread::_Shutdown #28884

Open
opened 2026-01-31 09:31:25 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/12181
Author: @lhecker
Created: 1/17/2022
Status: Merged
Merged: 1/24/2022
Merged by: @undefined

Base: mainHead: dev/lhecker/issue-12168-console-lock-crash


📝 Commits (5)

  • 7dedf50 Fix unbalanced unlock in PtySignalInputThread::_Shutdown
  • 169a78d Improve robustness of CloseConsoleProcessState
  • 609497f Fix audit checks
  • 6fe9843 Simplify pull request
  • c12b27a Fix build

📊 Changes

6 files changed (+7 additions, -8 deletions)

View changed files

📝 src/host/PtySignalInputThread.cpp (+1 -2)
📝 src/host/VtIo.cpp (+2 -0)
📝 src/host/output.cpp (+1 -1)
📝 src/interactivity/base/HostSignalInputThread.cpp (+0 -2)
📝 src/interactivity/base/ServiceLocator.cpp (+2 -2)
📝 src/interactivity/inc/ServiceLocator.hpp (+1 -1)

📄 Description

The only way to notice that LeaveCriticalSection() was called more
often than EnterCriticalSection() is by calling EnterCriticalSection()
again in the future, which will then deadlock.
Since this bug occurs on exit it wasn't noticeable with the old console lock.
With the new, stricter ticket lock this bug causes a fail-fast exit.

PR Checklist

Validation Steps Performed

  • Launch and then exit Windows Terminal
  • OpenConsole cleanly exits

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/12181 **Author:** [@lhecker](https://github.com/lhecker) **Created:** 1/17/2022 **Status:** ✅ Merged **Merged:** 1/24/2022 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/lhecker/issue-12168-console-lock-crash` --- ### 📝 Commits (5) - [`7dedf50`](https://github.com/microsoft/terminal/commit/7dedf50b14a58b597201684eab827ccb40d3ab84) Fix unbalanced unlock in PtySignalInputThread::_Shutdown - [`169a78d`](https://github.com/microsoft/terminal/commit/169a78dadd978f01785a1a985b70780769a9ed64) Improve robustness of CloseConsoleProcessState - [`609497f`](https://github.com/microsoft/terminal/commit/609497f89e4b74c494246884667a3e627340529a) Fix audit checks - [`6fe9843`](https://github.com/microsoft/terminal/commit/6fe9843f728a935fb350abeeeda3d9c3d13cfa4e) Simplify pull request - [`c12b27a`](https://github.com/microsoft/terminal/commit/c12b27ac5adf812e86673d5e74221d3b20f18062) Fix build ### 📊 Changes **6 files changed** (+7 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `src/host/PtySignalInputThread.cpp` (+1 -2) 📝 `src/host/VtIo.cpp` (+2 -0) 📝 `src/host/output.cpp` (+1 -1) 📝 `src/interactivity/base/HostSignalInputThread.cpp` (+0 -2) 📝 `src/interactivity/base/ServiceLocator.cpp` (+2 -2) 📝 `src/interactivity/inc/ServiceLocator.hpp` (+1 -1) </details> ### 📄 Description The only way to notice that LeaveCriticalSection() was called more often than EnterCriticalSection() is by calling EnterCriticalSection() again in the future, which will then deadlock. Since this bug occurs on exit it wasn't noticeable with the old console lock. With the new, stricter ticket lock this bug causes a fail-fast exit. ## PR Checklist * [x] Closes #12168 * [x] I work here * [x] Tests added/passed ## Validation Steps Performed * Launch and then exit Windows Terminal * OpenConsole cleanly exits ✅ --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:31:25 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#28884