microsoft / microsoft/terminal

Spamming OSC 52 copy freezes the application

Open
#20,210 7 comments 3 reactions 0 assignees View on GitHub
Issue-Bug Needs-Tag-Fix Priority-2 Priority-3 Product-Terminal
Dominant language
C++
Stars
105k
Forks
9.6k
Avg merge
3d 17h
Merged PRs (30d)
29

Description

### Windows Terminal version

1.24.10921.0

### Windows build number

10.0.26200.0

### Other Software

_No response_

### Steps to reproduce

1. Run the powershell script:
```ps1
$esc = [char]27

for ($i = 1; $i -le 200; $i++) {
$text = "copy-$i"
$b64 = [Convert]::ToBase64String(
[Text.Encoding]::UTF8.GetBytes($text)
)

$seq = "${esc}]52;c;${b64}${esc}\"

[Console]::Out.Write($seq)
[Console]::Out.Flush()

Start-Sleep -Milliseconds 20
}
```
Or the bash command in WSL:
```bash
for i in $(seq 1 200); do printf '\033]52;c;%s\033\\' "$(printf "copy-%d" "$i" | base64 -w0)"; sleep 0.02; done
```

2. Click around the terminal a couple of times while it's running. The application freezes.

### Expected Behavior

The application should still respond normally.

### Actual Behavior

The application freezes (shows `(Not Responding)` on the window title).

---

Also freezes in `1.25.260427001-preview`
I tried a few older releases. Doesn't freeze in `1.23.260121001`.

Contributor guide

Open the contributing guide

Research direction

Reproduce the freeze with the provided PowerShell script or WSL bash command while interacting with the terminal. Trace the OSC 52 copy handling and compare the affected releases with 1.23.260121001, where the issue does not occur. Done means repeated OSC 52 copies no longer make Windows Terminal show “Not Responding” or stop responding.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, cpp, powershell
Domain
cli, desktop, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.