[PR #10449] [MERGED] Fix startup race of resizing ConPTY #28055

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/10449
Author: @miniksa
Created: 6/18/2021
Status: Merged
Merged: 6/22/2021
Merged by: @undefined

Base: mainHead: dev/miniksa/pty_resize_race


📝 Commits (3)

📊 Changes

4 files changed (+42 additions, -65 deletions)

View changed files

📝 src/host/ConsoleArguments.cpp (+1 -32)
📝 src/host/ConsoleArguments.hpp (+0 -9)
📝 src/host/PtySignalInputThread.cpp (+28 -24)
📝 src/host/PtySignalInputThread.hpp (+13 -0)

📄 Description

Fix startup race of resizing ConPTY

  • Depending on what the timing and ordering is of the message coming in
    from the signal thread, it may be applied to the startup structure
    after the I/O thread has begun initializing the console buffer
    structures but before it has signaled that it is done and the signal
    thread is ready to make changes directly. This likely happens because
    the end of the I/O thread setup has a weird unlock/lock jog for the
    input thread and the signal thread might have been scheduled in the
    middle of it.
  • My resolution here is to ensure that the signal thread just keeps
    storing the latest resize message until it is told that everything is
    initialized. Whomever comes in to tell the signal thread this
    information (under lock) will pickup and run the resize if one came in
    before everything was ready. This should resolve the race.

Validation Steps Performed

  • o-sdn-o confirms this resolves their issue

Closes #10400


🔄 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/10449 **Author:** [@miniksa](https://github.com/miniksa) **Created:** 6/18/2021 **Status:** ✅ Merged **Merged:** 6/22/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/miniksa/pty_resize_race` --- ### 📝 Commits (3) - [`a2e8f02`](https://github.com/microsoft/terminal/commit/a2e8f02b0f0bb1739f5e75db01ec3c01c6a36767) Proposal to fix startup race with resizing - [`a8cf59b`](https://github.com/microsoft/terminal/commit/a8cf59bf99c19d26642f100882fe0d4c1ec94cb8) leftover future decl - [`76bd9e4`](https://github.com/microsoft/terminal/commit/76bd9e40713a7aa21060124e3ad1158095c521a8) Leonard nit ### 📊 Changes **4 files changed** (+42 additions, -65 deletions) <details> <summary>View changed files</summary> 📝 `src/host/ConsoleArguments.cpp` (+1 -32) 📝 `src/host/ConsoleArguments.hpp` (+0 -9) 📝 `src/host/PtySignalInputThread.cpp` (+28 -24) 📝 `src/host/PtySignalInputThread.hpp` (+13 -0) </details> ### 📄 Description Fix startup race of resizing ConPTY - Depending on what the timing and ordering is of the message coming in from the signal thread, it may be applied to the startup structure after the I/O thread has begun initializing the console buffer structures but before it has signaled that it is done and the signal thread is ready to make changes directly. This likely happens because the end of the I/O thread setup has a weird unlock/lock jog for the input thread and the signal thread might have been scheduled in the middle of it. - My resolution here is to ensure that the signal thread just keeps storing the latest resize message until it is told that everything is initialized. Whomever comes in to tell the signal thread this information (under lock) will pickup and run the resize if one came in before everything was ready. This should resolve the race. ## Validation Steps Performed - o-sdn-o confirms this resolves their issue Closes #10400 --- <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:26:01 +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#28055