Infinite loop in Command Prompt makes the whole Terminal window unresponsive #23486

Closed
opened 2026-01-31 08:43:41 +00:00 by claunia · 5 comments
Owner

Originally created by @AndresLuga on GitHub (Jul 29, 2025).

Windows Terminal version

1.23.11752.0

Windows build number

10.0.19045.6093

Other Software

No response

Steps to reproduce

  1. Execute the following in Command Prompt:
    FOR /L %N IN () DO @echo %time%

  2. Click "X" in the upper right to close the window.

  3. Press Ctrl-C.


Alternative:
0.1. Execute the following in Powershell:
while($true) {Get-Date}

0.2. Open Command Prompt in new Terminal tab.

  1. Execute the following in Command Prompt:
    FOR /L %N IN () DO @echo %time%

  2. Click "X" in the upper right to close the window.

  3. Press Ctrl-C.

Expected Behavior

Step 2: clicking "X" closes the window.
Step 3: Pressing Ctrl-C cancels the loop.

Actual Behavior

Step 2: clicking "X" makes the window unresponsive.
Step 3: Pressing Ctrl-C doesn't register (has no effect).

Originally created by @AndresLuga on GitHub (Jul 29, 2025). ### Windows Terminal version 1.23.11752.0 ### Windows build number 10.0.19045.6093 ### Other Software _No response_ ### Steps to reproduce 1. Execute the following in Command Prompt: `FOR /L %N IN () DO @echo %time%` 2. Click "X" in the upper right to close the window. 3. Press Ctrl-C. ------------------------- Alternative: 0.1. Execute the following in Powershell: `while($true) {Get-Date}` 0.2. Open Command Prompt in new Terminal tab. 1. Execute the following in Command Prompt: `FOR /L %N IN () DO @echo %time%` 2. Click "X" in the upper right to close the window. 3. Press Ctrl-C. ### Expected Behavior Step 2: clicking "X" closes the window. Step 3: Pressing Ctrl-C cancels the loop. ### Actual Behavior Step 2: clicking "X" makes the window unresponsive. Step 3: Pressing Ctrl-C doesn't register (has no effect).
Author
Owner

@JonathanGA2023 commented on GitHub (Jul 30, 2025):

I'm on Windows 11 23H2 running CMD as administrator and was unable to replicate this. Was it fixed?

@JonathanGA2023 commented on GitHub (Jul 30, 2025): I'm on Windows 11 23H2 running CMD as administrator and was unable to replicate this. Was it fixed?
Author
Owner

@lhecker commented on GitHub (Jul 30, 2025):

The PowerShell script does not reproduce the issue for me, but the CMD one does.

...and holy hell. How does it cause this issue? That's the weirdest terminal bug I've seen in a very long time, perhaps ever. Here's a video of it:

https://github.com/user-attachments/assets/2340e9ab-8163-46ee-82f2-47f8f5d2eada

You can't see it but at the 15s mark the cursor will be flickering. That's a video recording artifact. What actually happens is that the cursor turns into an I-beam because I double-clicked the invisible (!) tab that I opened and am editing the tab title (!!!!). Also:

  • Content is not scrolling past the first page (??)
  • Hence, the scrollbar is not updating
  • Cannot make selections / UI is very laggy (easily >10s lag)

My suspicion is that this happens due to CMD spamming title updates, us feeding that into WinUI and WinUI killing itself (as is tradition).

@lhecker commented on GitHub (Jul 30, 2025): The PowerShell script does not reproduce the issue for me, but the CMD one does. ...and holy hell. How does it cause this issue? That's the weirdest terminal bug I've seen in a very long time, perhaps ever. Here's a video of it: https://github.com/user-attachments/assets/2340e9ab-8163-46ee-82f2-47f8f5d2eada You can't see it but at the 15s mark the cursor will be flickering. That's a video recording artifact. What actually happens is that the cursor turns into an I-beam because I double-clicked the invisible (!) tab that I opened and am editing the tab title (!!!!). Also: * Content is not scrolling past the first page (??) * Hence, the scrollbar is not updating * Cannot make selections / UI is very laggy (easily >10s lag) My suspicion is that this happens due to CMD spamming title updates, us feeding that into WinUI and WinUI killing itself (as is tradition).
Author
Owner

@AndresLuga commented on GitHub (Jul 30, 2025):

It also doesn't reproduce when system is very busy. For example when IntelBurninTest is running with Stress Level "High". Then Command Prompt window contents updates a lot more slowly, also both closing the Terminal window and Ctrl-C work as expected.

@AndresLuga commented on GitHub (Jul 30, 2025): It also doesn't reproduce when system is very busy. For example when IntelBurninTest is running with Stress Level "High". Then Command Prompt window contents updates a lot more slowly, also both closing the Terminal window and Ctrl-C work as expected.
Author
Owner

@DHowett commented on GitHub (Jul 30, 2025):

My suspicion is that this happens due to CMD spamming title updates, us feeding that into WinUI and WinUI killing itself (as is tradition).

🤦🏻🤦🏻🤦🏻

trailing debounce incoming?

@DHowett commented on GitHub (Jul 30, 2025): > My suspicion is that this happens due to CMD spamming title updates, us feeding that into WinUI and WinUI killing itself (as is tradition). 🤦🏻🤦🏻🤦🏻 trailing debounce incoming?
Author
Owner

@DHowett commented on GitHub (Jul 30, 2025):

Sorry, we're on a triage call right now and I just can't. This whole bug.

Good find. Thank you.

@DHowett commented on GitHub (Jul 30, 2025): Sorry, we're on a triage call right now and I just _can't_. This whole bug. Good find. Thank you.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#23486