xpra icon
Bug tracker and wiki

Opened 3 weeks ago

Closed 3 weeks ago

Last modified 3 weeks ago

#2757 closed defect (fixed)

scroll paint corruption

Reported by: Antoine Martin Owned by: Antoine Martin
Priority: critical Milestone: 4.0
Component: core Version: 3.0.x
Keywords: Cc:

Description

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).

Attachments (6)

scroll-corruption.png (34.7 KB) - added by Antoine Martin 3 weeks ago.
screenshot of the paint corruption
replay-scrolls.patch (5.5 KB) - added by Antoine Martin 3 weeks ago.
patch to save and replay scrolls later
cairo_replayscroll2.py (4.1 KB) - added by Antoine Martin 3 weeks ago.
replay in two separate windows (original and copy)
test_scrolling.py (1.5 KB) - added by Antoine Martin 3 weeks ago.
script to generate scrolling data from 2 pictures
scroll-27.png (129.8 KB) - added by Antoine Martin 3 weeks ago.
pic1
scroll-28.png (126.9 KB) - added by Antoine Martin 3 weeks ago.
pic2

Download all attachments as: .zip

Change History (13)

Changed 3 weeks ago by Antoine Martin

Attachment: scroll-corruption.png added

screenshot of the paint corruption

comment:1 Changed 3 weeks ago by Antoine Martin

Status: newassigned

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:

comment:2 Changed 3 weeks ago by 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.

comment:3 Changed 3 weeks ago by 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?

comment:4 Changed 3 weeks ago by 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).

Changed 3 weeks ago by Antoine Martin

Attachment: replay-scrolls.patch added

patch to save and replay scrolls later

Changed 3 weeks ago by Antoine Martin

Attachment: cairo_replayscroll2.py added

replay in two separate windows (original and copy)

comment:5 Changed 3 weeks ago by Antoine Martin

Bug could be server-side?

Changed 3 weeks ago by Antoine Martin

Attachment: test_scrolling.py added

script to generate scrolling data from 2 pictures

Changed 3 weeks ago by Antoine Martin

Attachment: scroll-27.png added

pic1

Changed 3 weeks ago by Antoine Martin

Attachment: scroll-28.png added

pic2

comment:6 Changed 3 weeks ago by 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):

  • 2nd chunk moves up by 26: from 1235, 80 pixels high -> rectangle from 1209 to 1289
  • 3rd chunk moves down by 26: from 1172, 37 pixels high -> rectangle from 1198 to 1235

Overlaps should never occur!

Last edited 3 weeks ago by Antoine Martin (previous) (diff)

comment:7 Changed 3 weeks ago by Antoine Martin

Resolution: fixed
Status: assignedclosed

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.

Last edited 3 weeks ago by Antoine Martin (previous) (diff)
Note: See TracTickets for help on using tickets.