[PR #14041] Fix potential lags/deadlocks during tab close #29901

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

Original Pull Request: https://github.com/microsoft/terminal/pull/14041

State: closed
Merged: Yes


ConptyClosePseudoConsole blocks until OpenConsole exits.
This is problematic for the changes in 666c446, which stopped calling that
function on a background thread to solve a race condition. This commit fixes
the potential lags/deadlocks from waiting on OpenConsole's exit, by adding
ConptyClosePseudoConsoleNoWait which only closes the IO handles and allows
OpenConsole to exit naturally. This uncovered another potential deadlock
in ServiceLocator::RundownAndExit which might call itself recursively.

Closes #14032

Validation Steps Performed

  • Print tons of text and concurrently close the tab.
    Tab closes, OpenConsole/pwsh exits instantly
  • Use Enter-VsDevShell and close the tab.
    Tab closes instantly, OpenConsole/pwsh exits after ~5 seconds
**Original Pull Request:** https://github.com/microsoft/terminal/pull/14041 **State:** closed **Merged:** Yes --- `ConptyClosePseudoConsole` blocks until OpenConsole exits. This is problematic for the changes in 666c446, which stopped calling that function on a background thread to solve a race condition. This commit fixes the potential lags/deadlocks from waiting on OpenConsole's exit, by adding `ConptyClosePseudoConsoleNoWait` which only closes the IO handles and allows OpenConsole to exit naturally. This uncovered another potential deadlock in `ServiceLocator::RundownAndExit` which might call itself recursively. Closes #14032 ## Validation Steps Performed * Print tons of text and concurrently close the tab. Tab closes, OpenConsole/pwsh exits instantly ✅ * Use `Enter-VsDevShell` and close the tab. Tab closes instantly, OpenConsole/pwsh exits after ~5 seconds ✅
claunia added the pull-request label 2026-01-31 09:37:31 +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#29901