Xpra: Ticket #2757: scroll paint corruption

Trying to reproduce the memleak (#2730), I modified the simulate_console_user.py script and ran it in an xterm: windows.1.geometry=(1147, 229, 1423, 1408). Semi reliably, the scroll paints end up corrupting the screen during the last part of the test (after ps -ef).

Thu, 07 May 2020 04:37:57 GMT - Antoine Martin: attachment set

screenshot of the paint corruption

Thu, 07 May 2020 04:45:14 GMT - Antoine Martin: status changed

screenshot of the paint corruption (ignore the black box that cuts the xterm near sleep(0.5) - that's an artifact of using scrot for the screenshot)

Could be caused by:

Thu, 07 May 2020 04:59:17 GMT - Antoine Martin:

Looks like this is caused by the switch to non-opengl windows for 'text' content added in r26145. r26274 makes it possible to force opengl on for all windows that can support opengl, including 'text' windows (xpra attach --opengl=force) and the corruption disappears.

Thu, 07 May 2020 12:32:23 GMT - Antoine Martin:

Simply turning on paint debugging with XPRA_PAINT_BOX=1 xpra attach made the bug "disappear", so it looks like a race condition of some sort. I'm not sure if r26276 makes it harder to hit the bug, should not hurt to have it? r26277 seems to make it easier to reproduce the bug?

Thu, 07 May 2020 14:21:05 GMT - Antoine Martin:

r26281 improves the cairo scroll paint code slightly.

Testing with the changes from r26277, the corruption seems to occur where the edge of the scroll bar on the left hand side aligns with the terminal output. The scroll list ends up divided there (the page scrolls up, the scroll bar moves in the opposite direction).

Thu, 07 May 2020 15:36:50 GMT - Antoine Martin: attachment set

patch to save and replay scrolls later

Thu, 07 May 2020 16:19:29 GMT - Antoine Martin: attachment set

replay in two separate windows (original and copy)

Thu, 07 May 2020 16:21:08 GMT - Antoine Martin:

Bug could be server-side?

Fri, 08 May 2020 08:12:05 GMT - Antoine Martin: attachment set

script to generate scrolling data from 2 pictures

Fri, 08 May 2020 08:12:40 GMT - Antoine Martin: attachment set


Fri, 08 May 2020 08:12:53 GMT - Antoine Martin: attachment set


Fri, 08 May 2020 08:25:19 GMT - Antoine Martin:

Running the test script to generate scroll data:

$ test_scrolling.py ./scroll-27.png ./scroll-28.png
0, 28, 1339, 1181, 0, -26
0, 1235, 1339, 80, 0, -26
0, 1172, 1339, 37, 0, 26
0, 1237, 1339, 26, 0, 52

This matches the data captured from the client, and replaying the scroll changes produces an image that's wrong. Can be seen using:

$ cairo_replayscroll2.py ./scroll-28.png scroll-28.txt

The 3rd chunk is wrong and overlaps with data from the 2nd chunk (omitting horizontal coordinates which are always the same):

Overlaps should never occur!

Fri, 08 May 2020 14:09:10 GMT - Antoine Martin: status changed; resolution set

Fixed in r26287. (also avoid harmless debug overflow in r26284)

Explanation: comment:6 is wrong. Overlaps can and do happen, we should not try to avoid them at all costs. The cost of splitting one large scroll region can be higher. We have to keep track of which lines have been sent using 'scroll', that was also used to shortcut out and skip sending the same line again... but that was done badly: when we're in the loop because we're counting how many lines to include in a scroll region, we need to keep counting, not skip it.

Backport to v3.0.x in r26288.

For those stuck on v3.0.9 and earlier, you can start your server with:

XPRA_SCROLL_ENCODING=0 xpra start ...

To disable scroll encoding completely. The loss of performance with some workloads can be pretty significant.

Sat, 23 Jan 2021 05:59:56 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/2757