Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrollback buffer occasionally gets corrupted #2619

Closed
kdrag0n opened this issue May 1, 2020 · 9 comments
Closed

Scrollback buffer occasionally gets corrupted #2619

kdrag0n opened this issue May 1, 2020 · 9 comments

Comments

@kdrag0n
Copy link

kdrag0n commented May 1, 2020

Sometimes, leaving a terminal pane scrolled to a position above the current for a while and then scrolling back down corrupts some parts of the scrollback buffer's contents in between those positions. There does not need to be any new output in the buffer since scrolling up for the bug to manifest.

Here's an example of this bug:

image

I've observed this issue on two different Linux systems. It doesn't appear to manifest unless there is a substantial amount of data in the scrollback buffer (tens of thousands of lines?), but I haven't verified that. I believe it's started to happen less frequently in the past few months (it used to be much more frequent last year), but it still happens very rarely. If I remember correctly, this issue has been around since I started using kitty. Sometimes the affected text is completely corrupted, but usually it still has some comprehensible segments.

Relevant kitty config option: scrollback_lines 1000000
Kitty version: 0.17.3

I understand that it's hard for you to fix this issue without a reliable reproducer, but I thought I'd report it anyway so you're at least aware of it. Perhaps there's a memory corruption issue that could be caught by running kitty in Valgrind or with ASAN?

@kovidgoyal
Copy link
Owner

Without a reproducer fixing this pretty impossible. If you want to run kitty with asan, use make asan. https://sw.kovidgoyal.net/kitty/build.html

@jc00ke
Copy link

jc00ke commented Jul 25, 2020

image

I'm not sure if this is the exact same issue I'm experiencing (I think it is) but I've seen these artifacts since upgrading to 0.18.x.

@The-Compiler
Copy link
Contributor

I do have a reliable way to reproduce this issue (or at least a closely related one?):

  • Output the following ASCII table, making sure that it (barely) fits on the screen
+---+-----------------------+----------+----------+-------+----------+------+-------+-----------+
| # | Station               | Platform | Date     | Time  | Duration | Chg. | With  | Occupancy |
+---+-----------------------+----------+----------+-------+----------+------+-------+-----------+
|   | Rüti ZH, Steinstrasse |    -     | 17/09/20 | 10:36 |   0:07   |      | B 884 | 1:        |
|   | Rüti ZH, Bahnhof      |    -     | 17/09/20 | 10:43 |          |      |       | 2:        |
|   |                       |          |          |       |          |      |       |           |
| 0 | Rüti ZH, Bahnhof      |    -     | 17/09/20 | 10:43 |   0:02   |  1   |       | 1:        |
|   | Rüti ZH               |    -     | 17/09/20 | 10:45 |          |      |       | 2:        |
|   |                       |          |          |       |          |      |       |           |
|   | Rüti ZH               |    2     | 17/09/20 | 10:54 |   0:07   |      | S 5   | 1:        |
|   | Rapperswil            |    3     | 17/09/20 | 11:01 |          |      |       | 2:        |
+---+-----------------------+----------+----------+-------+----------+------+-------+-----------+
|   | Rüti ZH, Steinstrasse |    -     | 17/09/20 | 10:51 |   0:07   |      | B 884 | 1:        |
|   | Rüti ZH, Bahnhof      |    -     | 17/09/20 | 10:58 |          |      |       | 2:        |
|   |                       |          |          |       |          |      |       |           |
| 1 | Rüti ZH, Bahnhof      |    -     | 17/09/20 | 10:58 |   0:02   |  1   |       | 1:        |
|   | Rüti ZH               |    -     | 17/09/20 | 11:00 |          |      |       | 2:        |
|   |                       |          |          |       |          |      |       |           |
|   | Rüti ZH               |    2     | 17/09/20 | 11:09 |   0:07   |      | S 15  | 1:        |
|   | Rapperswil            |    3     | 17/09/20 | 11:16 |          |      |       | 2:        |
+---+-----------------------+----------+----------+-------+----------+------+-------+-----------+
|   | Rüti ZH, Steinstrasse |    -     | 17/09/20 | 11:06 |   0:07   |      | B 884 | 1:        |
|   | Rüti ZH, Bahnhof      |    -     | 17/09/20 | 11:13 |          |      |       | 2:        |
|   |                       |          |          |       |          |      |       |           |
| 2 | Rüti ZH, Bahnhof      |    -     | 17/09/20 | 11:13 |   0:02   |  1   |       | 1:        |
|   | Rüti ZH               |    -     | 17/09/20 | 11:15 |          |      |       | 2:        |
|   |                       |          |          |       |          |      |       |           |
|   | Rüti ZH               |    2     | 17/09/20 | 11:24 |   0:07   |      | S 5   | 1:        |
|   | Rapperswil            |    3     | 17/09/20 | 11:31 |          |      |       | 2:        |
+---+-----------------------+----------+----------+-------+----------+------+-------+-----------+
|   | Rüti ZH, Steinstrasse |    -     | 17/09/20 | 11:21 |   0:07   |      | B 884 | 1:        |
|   | Rüti ZH, Bahnhof      |    -     | 17/09/20 | 11:28 |          |      |       | 2:        |
|   |                       |          |          |       |          |      |       |           |
| 3 | Rüti ZH, Bahnhof      |    -     | 17/09/20 | 11:28 |   0:02   |  1   |       | 1:        |
|   | Rüti ZH               |    -     | 17/09/20 | 11:30 |          |      |       | 2:        |
|   |                       |          |          |       |          |      |       |           |
|   | Rüti ZH               |    2     | 17/09/20 | 11:39 |   0:07   |      | S 15  | 1:        |
|   | Rapperswil            |    3     | 17/09/20 | 11:46 |          |      |       | 2:        |
+---+-----------------------+----------+----------+-------+----------+------+-------+-----------+

image

  • Zoom in so that part of the text now ends up above the viewport:

image

That part then gets corrupted - instead of:

|   | Rüti ZH               |    2     | 17/09/20 | 10:54 |   0:07   |      | S 5   | 1:        |
|   | Rapperswil            |    3     | 17/09/20 | 11:01 |          |      |       | 2:        |
+---+-----------------------+----------+----------+-------+----------+------+-------+-----------+
|   | Rüti ZH, Steinstrasse |    -     | 17/09/20 | 10:51 |   0:07   |      | B 884 | 1:        |
|   | Rüti ZH, Bahnhof      |    -     | 17/09/20 | 10:58 |          |      |       | 2:        |

it now says:

image

However, it seems to only be a displaying problem - copying the text results in the correct contents. Zooming out again also results in the correct contents again.

--debug-config:

kitty 0.18.3 created by Kovid Goyal
Linux aragog 5.8.9-arch2-1 #1 SMP PREEMPT Sun, 13 Sep 2020 23:44:55 +0000 x86_64
Arch Linux \r (\l)
LSB_VERSION=1.4
DISTRIB_ID=Arch
DISTRIB_RELEASE=rolling
DISTRIB_DESCRIPTION="Arch Linux"
Loaded config files: debug.conf
Running under: X11

Config options different from defaults:
font_family Iosevka Nerd Font Complete
font_size   12.0
symbol_map  {(9211, 9214): 'Symbols-1000-em Nerd Font Complete', (11096, 11096): 'Symbols-1000-em Nerd Font Complete', (57856, 58025): 'Symbols-1000-em Nerd Font Complete', (57504, 57507): 'Symbols-1000-em Nerd Font Complete', (57520, 57535): 'Symbols-1000-em Nerd Font Complete', (57536, 57544): 'Symbols-1000-em Nerd Font Complete', (57548, 57551): 'Symbols-1000-em Nerd Font Complete', (57552, 57554): 'Symbols-1000-em Nerd Font Complete', (57556, 57556): 'Symbols-1000-em Nerd Font Complete', (59136, 59333): 'Symbols-1000-em Nerd Font Complete', (61440, 62176): 'Symbols-1000-em Nerd Font Complete', (9829, 9829): 'Symbols-1000-em Nerd Font Complete', (9889, 9889): 'Symbols-1000-em Nerd Font Complete', (62464, 62632): 'Symbols-1000-em Nerd Font Complete', (63100, 63100): 'Symbols-1000-em Nerd Font Complete', (57344, 57354): 'Symbols-1000-em Nerd Font Complete', (62208, 62227): 'Symbols-1000-em Nerd Font Complete', (58874, 58923): 'Symbols-1000-em Nerd Font Complete'}

@kovidgoyal
Copy link
Owner

By zoom in, you mean scroll?? And can you post the size in cells of your terminal window to reproduce. Get it with

tput cols
tput lines

@The-Compiler
Copy link
Contributor

The-Compiler commented Sep 17, 2020

No, I mean "zoom in" as in "increase the font size via Ctrl-Shift-Plus" (and then scroll up because due to the zooming, part of the output has now disappeared). It's not visible in the screenshot because GitHub scales them down, open the images in a new tab and without scaling to see the difference.

One example where I can reproduce it:

  • Before zooming: 142x47
  • After zooming: 103x36

@kovidgoyal
Copy link
Owner

OK I can reproduce with that, I will take a look.

@kovidgoyal
Copy link
Owner

Automated reproducer:

kitty -o allow_remote_control=y sh -c "cat /t/output.txt; kitty @ set-font-size +4; kitty @ scroll-window start; read"

@The-Compiler
Copy link
Contributor

Thanks for the quick fix! 🎉

@kovidgoyal
Copy link
Owner

You're welcome with a reproducer bug fixing becomes pretty trivial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants