Random parsing/rendering bugs when input arrives slowly #4301

Open
opened 2026-01-30 23:43:23 +00:00 by claunia · 2 comments
Owner

Originally created by @egmontkob on GitHub (Oct 5, 2019).

Environment

Windows build number: Win32NT 10.0.18362.0
Windows Terminal version (if applicable): 0.5.2762.0

Steps to reproduce

This bug sounds similar to #3080 and #3081, but this time all the escape sequences are supported by WT, and I don't have a fully reproducible test case, it all seems random.

Resize the terminal to 28 rows (my default due to bug 2061, nevermind).

Execute this a couple of times:

slowcat -t 200000 parsing-delay.txt

whereas slowcat is shipped with VTE and does exactly what you would think, with the parameter being in microseconds, i.e. prints one byte every 0.2 seconds in the above example; and

parsing-delay.txt is the test file stripped down as much as I had patience.

Modify the numeric parameter in the ballpark of 200000 – 350000 (i.e. ~3–5 bytes per second) as you feel like, I have no idea if it influences the behavior, sometimes it feels so but it could just be random. :)

Note that at the end of the command, you're left on the alternate screen. It switches to the normal screen for a short time in the middle and then back to the alternate one.

Expected behavior

The same thing should happen all the time as you repeat this command (except at the first time when you begin on the normal screen), without the spurious random 1 and h described below.

Actual behavior

When switched back to the normal screen for a short time, sometimes a digit 1 appears in the bottom left corner. Even more interestingly, the number of such 1s in that row keeps growing, despite the cursor being explicitly moved to row 28 column 1 every time. (And changing that to column 2 keeps it a digit 1 that appears, so it's not where it comes from.)

When switched back to the alternate screen, sometimes a letter h appears at the top left.

Both artifacts occur to me with a probability of perhaps 25–50-ish %. Play with the timing constant if they don't want to appear to you, it might make a difference, I'm not sure.

Originally created by @egmontkob on GitHub (Oct 5, 2019). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: Win32NT 10.0.18362.0 Windows Terminal version (if applicable): 0.5.2762.0 ``` # Steps to reproduce This bug sounds similar to #3080 and #3081, but this time all the escape sequences are supported by WT, and I don't have a fully reproducible test case, it all seems random. Resize the terminal to 28 rows (my default due to bug 2061, nevermind). Execute this a couple of times: slowcat -t 200000 parsing-delay.txt whereas `slowcat` is [shipped with VTE](https://gitlab.gnome.org/GNOME/vte/) and does exactly what you would think, with the parameter being in microseconds, i.e. prints one byte every 0.2 seconds in the above example; and [parsing-delay.txt](https://github.com/microsoft/terminal/files/3693636/parsing-delay.txt) is the test file stripped down as much as I had patience. Modify the numeric parameter in the ballpark of 200000 – 350000 (i.e. ~3–5 bytes per second) as you feel like, I have no idea if it influences the behavior, sometimes it feels so but it could just be random. :) Note that at the end of the command, you're left on the alternate screen. It switches to the normal screen for a short time in the middle and then back to the alternate one. # Expected behavior The same thing should happen all the time as you repeat this command (except at the first time when you begin on the normal screen), without the spurious random `1` and `h` described below. # Actual behavior When switched back to the normal screen for a short time, sometimes a digit `1` appears in the bottom left corner. Even more interestingly, the number of such `1`s in that row keeps growing, despite the cursor being explicitly moved to row 28 column 1 every time. (And changing that to column 2 keeps it a digit `1` that appears, so it's not where it comes from.) When switched back to the alternate screen, sometimes a letter `h` appears at the top left. Both artifacts occur to me with a probability of perhaps 25–50-ish %. Play with the timing constant if they don't want to appear to you, it might make a difference, I'm not sure.
claunia added the Help WantedProduct-ConhostIssue-BugArea-VT labels 2026-01-30 23:43:23 +00:00
Author
Owner

@egmontkob commented on GitHub (Oct 5, 2019):

(I started a script, and within that launched mc in a way that it starts with an error dialog due to the skin not being supported. I replayed the resulting typescript log using slowcat and noticed random characters appearing. Then I tried to track down the exact point where things go wrong. This is how I discoved these three bugs, and there can easily be more along these lines.)

@egmontkob commented on GitHub (Oct 5, 2019): (I started a `script`, and within that launched `mc` in a way that it starts with an error dialog due to the skin not being supported. I replayed the resulting `typescript` log using `slowcat` and noticed random characters appearing. Then I tried to track down the exact point where things go wrong. This is how I discoved these three bugs, and there can easily be more along these lines.)
Author
Owner

@DHowett-MSFT commented on GitHub (Oct 8, 2019):

It looks like when we fail to set the scrolling region (and I'm sure a great number of other things!), we fail the sequence that requested the invalid scrolling region, and conhost converts a failed sequence execution into a "send it to the terminal on the other side, it might know what to do with it." Then, because of #3081, we just send along the r.

We almost certainly need the tri-state "I handled this", "You should handle this", and "There's nothing of value to be done with this" during VT parsing and execution.

@DHowett-MSFT commented on GitHub (Oct 8, 2019): It looks like when we fail to set the scrolling region (and I'm sure a great number of other things!), we _fail the sequence that requested the invalid scrolling region,_ and conhost converts a failed sequence execution into a "send it to the terminal on the other side, it might know what to do with it." Then, because of #3081, we just send along the `r`. We almost certainly need the tri-state "I handled this", "You should handle this", and "There's nothing of value to be done with this" during VT parsing and execution.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#4301