Xpra: Ticket #242: 0.8.0: client-side errors in log

Changing encoding (x264 to rgb24; rgb24 to x264, etc.) when gwenview is running in xpra-0.8.0 session produces multiple errors in log:

2013-02-02 11:11:07,389 draw error
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/xpra/client.py", line 1168, in _do_draw
    window.draw_region(x, y, width, height, coding, data, rowstride, packet_sequence, options, [record_decode_time])
  File "/usr/lib/python2.7/dist-packages/xpra/platform/client_tray.py", line 127, in draw_region
    self._backing.draw_region(x, y, width, height, coding, img_data, rowstride, options, callbacks)
  File "/usr/lib/python2.7/dist-packages/xpra/window_backing.py", line 450, in draw_region
    self.paint_image(coding, img_data, x, y, width, height, rowstride, options, callbacks)
  File "/usr/lib/python2.7/dist-packages/xpra/window_backing.py", line 385, in paint_image
    img_data = self.process_delta(raw_data, width, height, rowstride, options)
  File "/usr/lib/python2.7/dist-packages/xpra/window_backing.py", line 112, in process_delta
    raise Exception("delta region references pixmap data we do not have!")
Exception: delta region references pixmap data we do not have!
2013-02-02 11:11:07,392 error processing draw packet
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/xpra/client.py", line 1124, in _draw_thread_loop
    self._do_draw(packet)
  File "/usr/lib/python2.7/dist-packages/xpra/client.py", line 1168, in _do_draw
    window.draw_region(x, y, width, height, coding, data, rowstride, packet_sequence, options, [record_decode_time])
  File "/usr/lib/python2.7/dist-packages/xpra/platform/client_tray.py", line 127, in draw_region
    self._backing.draw_region(x, y, width, height, coding, img_data, rowstride, options, callbacks)
  File "/usr/lib/python2.7/dist-packages/xpra/window_backing.py", line 450, in draw_region
    self.paint_image(coding, img_data, x, y, width, height, rowstride, options, callbacks)
  File "/usr/lib/python2.7/dist-packages/xpra/window_backing.py", line 385, in paint_image
    img_data = self.process_delta(raw_data, width, height, rowstride, options)
  File "/usr/lib/python2.7/dist-packages/xpra/window_backing.py", line 112, in process_delta
    raise Exception("delta region references pixmap data we do not have!")
Exception: delta region references pixmap data we do not have!

This problem is not specific to gwenview and affect some other applications. I've seen it in kmail too.



Sat, 02 Feb 2013 17:11:07 GMT - Antoine Martin: status changed; owner set

I'm not seeing it in either...

Does this patch fix things?

Index: src/xpra/window_source.py
===================================================================
--- src/xpra/window_source.py	(revision 2634)
+++ src/xpra/window_source.py	(working copy)
@@ -436,6 +436,8 @@
             #we will resend a key frame because it looks like we will
             #drop a frame which is being processed
             self.video_encoder_cleanup()
+        #clear delta since things got cancelled
+        self.last_pixmap_data = None
     def cancel_expire_timer(self):
         if self.expire_timer:

Sun, 03 Feb 2013 11:53:43 GMT - Antoine Martin:

I still cannot reproduce this (I suspect it has something to do with client DE and window resizing/positioning) so please try r2639 and see if it fixes things for you.


Mon, 04 Feb 2013 03:50:44 GMT - onlyjob:

I've seen few errors in 0.8.1 but after applying the patch from comment:1 I haven't seen errors for ~90m. This is not a final confirmation though as it happen to be more difficult to reproduce in 0.8.1. I will post another update later...


Mon, 04 Feb 2013 04:41:31 GMT - Antoine Martin:

The only difference between r2639 and the patch above is when we clear the last_pixmap_data reference: before instead of after the video encoder cleanup.. This is a race, I'll have to review again I guess.


Mon, 04 Feb 2013 06:04:54 GMT - onlyjob:

Reporting back as promised: patch didn't fixed it, at least not completely. I got

2013-02-04 16:52:33,272 draw error
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/xpra/client.py", line 1168, in _do_draw
    window.draw_region(x, y, width, height, coding, data, rowstride, packet_sequence, options, [record_decode_time])
  File "/usr/lib/python2.7/dist-packages/xpra/platform/client_tray.py", line 130, in draw_region
    self._backing.draw_region(x, y, width, height, coding, img_data, rowstride, options, callbacks)
  File "/usr/lib/python2.7/dist-packages/xpra/window_backing.py", line 450, in draw_region
    self.paint_image(coding, img_data, x, y, width, height, rowstride, options, callbacks)
  File "/usr/lib/python2.7/dist-packages/xpra/window_backing.py", line 385, in paint_image
    img_data = self.process_delta(raw_data, width, height, rowstride, options)
  File "/usr/lib/python2.7/dist-packages/xpra/window_backing.py", line 112, in process_delta
    raise Exception("delta region references pixmap data we do not have!")
Exception: delta region references pixmap data we do not have!
2013-02-04 16:52:33,274 error processing draw packet
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/xpra/client.py", line 1124, in _draw_thread_loop
    self._do_draw(packet)
  File "/usr/lib/python2.7/dist-packages/xpra/client.py", line 1168, in _do_draw
    window.draw_region(x, y, width, height, coding, data, rowstride, packet_sequence, options, [record_decode_time])
  File "/usr/lib/python2.7/dist-packages/xpra/platform/client_tray.py", line 130, in draw_region
    self._backing.draw_region(x, y, width, height, coding, img_data, rowstride, options, callbacks)
  File "/usr/lib/python2.7/dist-packages/xpra/window_backing.py", line 450, in draw_region
    self.paint_image(coding, img_data, x, y, width, height, rowstride, options, callbacks)
  File "/usr/lib/python2.7/dist-packages/xpra/window_backing.py", line 385, in paint_image
    img_data = self.process_delta(raw_data, width, height, rowstride, options)
  File "/usr/lib/python2.7/dist-packages/xpra/window_backing.py", line 112, in process_delta
    raise Exception("delta region references pixmap data we do not have!")
Exception: delta region references pixmap data we do not have!

in last few hours but that's much much less then what 0.8.0 was logging. I reckon r2639 helped. Also it is definitely more difficult to replicate -- I couldn't quite get it deliberately, those errors just appears sometimes and I don't know why or what action produces them...


Tue, 05 Feb 2013 09:17:51 GMT - Antoine Martin:

I still do not fully understand what is going on here.

Threads are involved, so it may well be a race - it does look like one - I just can't see where... or maybe I can?
So here is an explanation of what delta does, both for my own sake, also documentation can't hurt (this should go on the wiki when fixed), and so that you can proof read it and hopefully spot something stupid I have missed.
Server side:

Since r2660, we also clear it when the client reports failing to decode a frame (using a negative decode time). This is only for recovering quicker, it doesn't fix the underlying issue which is that the client does not have the pixmap that the server thinks it has.. The client should never fail to decode frames. (*)

Client side:


The problem you are seeing comes from the fact that the server relies on the client having a copy of a frame (as the server sent a "store" previously) and it does not. Special cases:

Maybe: we get the draw before the window has had a chance of showing up? (new windows are processed in the UI thread, draws are not and therefore may get there quicker)


Tue, 05 Feb 2013 10:31:48 GMT - Antoine Martin:

Can you please test r2661 and r2662 and tell me if either of them fixes the issue. I don't like r2662 much because it makes us use the UI thread for one instruction, just to ensure they are processed in the right order (it is very hard to come up with a better solution). But unfortunately, I think this is the cause of the problem you reported.


Tue, 05 Feb 2013 13:13:11 GMT - onlyjob:

So far tried r2661 -- it works great with new libav-9.1 but doesn't fix the problem with "draw" errors logged. I will test r2662 soon.


Wed, 06 Feb 2013 01:00:31 GMT - onlyjob:

I think we can declare r2662 as viable fix for the issue.

With r2662 applied on top of 0.8.1 (together with r2661) I haven't seen a single draw error for hours.

Well done.


Wed, 06 Feb 2013 04:26:56 GMT - Antoine Martin: status changed; resolution set

Thanks for all the testing.


Sat, 23 Jan 2021 04:49:24 GMT - migration script:

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