Xpra: Ticket #339: Assertion error when receiving data

Hello,

when running Xpra 0.9.2 on server with latest trunk client as of this writing, the software works, but about 50% of updates are discarded with the following messages:

2013-05-17 14:23:49,098 draw error
Traceback (most recent call last):
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/ui_client_base.py", line 986, in _do_draw
    window.draw_region(x, y, width, height, coding, data, rowstride, packet_sequence, options, [record_decode_time])
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/client_window_base.py", line 258, in draw_region
    self._backing.draw_region(x, y, width, height, coding, img_data, rowstride, options, callbacks)
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/window_backing_base.py", line 277, in draw_region
    self.paint_image(coding, img_data, x, y, width, height, rowstride, options, callbacks)
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/gtk2/window_backing.py", line 40, in paint_image
    return GTKWindowBacking.paint_image(self, coding, img_data, x, y, width, height, rowstride, options, callbacks)
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/window_backing_base.py", line 133, in paint_image
    img_data = self.process_delta(raw_data, width, height, rowstride, options)
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/window_backing_base.py", line 104, in process_delta
    assert len(img_data) == rowstride * height, "expected %s bytes but received %s" % (rowstride * height, len(img_data))
AssertionError: expected 3136 bytes but received 3135
2013-05-17 14:23:49,099 error processing draw packet
Traceback (most recent call last):
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/ui_client_base.py", line 940, in _draw_thread_loop
    self._do_draw(packet)
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/ui_client_base.py", line 986, in _do_draw
    window.draw_region(x, y, width, height, coding, data, rowstride, packet_sequence, options, [record_decode_time])
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/client_window_base.py", line 258, in draw_region
    self._backing.draw_region(x, y, width, height, coding, img_data, rowstride, options, callbacks)
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/window_backing_base.py", line 277, in draw_region
    self.paint_image(coding, img_data, x, y, width, height, rowstride, options, callbacks)
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/gtk2/window_backing.py", line 40, in paint_image
    return GTKWindowBacking.paint_image(self, coding, img_data, x, y, width, height, rowstride, options, callbacks)
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/window_backing_base.py", line 133, in paint_image
    img_data = self.process_delta(raw_data, width, height, rowstride, options)
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/window_backing_base.py", line 104, in process_delta
    assert len(img_data) == rowstride * height, "expected %s bytes but received %s" % (rowstride * height, len(img_data))
AssertionError: expected 3136 bytes but received 3135
2013-05-17 14:23:49,101 draw error
Traceback (most recent call last):
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/ui_client_base.py", line 986, in _do_draw
    window.draw_region(x, y, width, height, coding, data, rowstride, packet_sequence, options, [record_decode_time])
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/client_window_base.py", line 258, in draw_region
    self._backing.draw_region(x, y, width, height, coding, img_data, rowstride, options, callbacks)
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/window_backing_base.py", line 277, in draw_region
    self.paint_image(coding, img_data, x, y, width, height, rowstride, options, callbacks)
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/gtk2/window_backing.py", line 40, in paint_image
    return GTKWindowBacking.paint_image(self, coding, img_data, x, y, width, height, rowstride, options, callbacks)
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/window_backing_base.py", line 133, in paint_image
    img_data = self.process_delta(raw_data, width, height, rowstride, options)
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/window_backing_base.py", line 104, in process_delta
    assert len(img_data) == rowstride * height, "expected %s bytes but received %s" % (rowstride * height, len(img_data))
AssertionError: expected 260 bytes but received 234
2013-05-17 14:23:49,103 error processing draw packet
Traceback (most recent call last):
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/ui_client_base.py", line 940, in _draw_thread_loop
    self._do_draw(packet)
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/ui_client_base.py", line 986, in _do_draw
    window.draw_region(x, y, width, height, coding, data, rowstride, packet_sequence, options, [record_decode_time])
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/client_window_base.py", line 258, in draw_region
    self._backing.draw_region(x, y, width, height, coding, img_data, rowstride, options, callbacks)
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/window_backing_base.py", line 277, in draw_region
    self.paint_image(coding, img_data, x, y, width, height, rowstride, options, callbacks)
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/gtk2/window_backing.py", line 40, in paint_image
    return GTKWindowBacking.paint_image(self, coding, img_data, x, y, width, height, rowstride, options, callbacks)
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/window_backing_base.py", line 133, in paint_image
    img_data = self.process_delta(raw_data, width, height, rowstride, options)
  File "/home/arthur/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/window_backing_base.py", line 104, in process_delta
    assert len(img_data) == rowstride * height, "expected %s bytes but received %s" % (rowstride * height, len(img_data))
AssertionError: expected 260 bytes but received 234


Fri, 17 May 2013 12:28:43 GMT - ahuillet:

Output with XPRA_DRAW_DEBUG=1:

2013-05-17 14:28:01,145 draw_region(0, 0, 17, 17, rgb24, 681 bytes, 52, {'zlib': 5, 'store': 2}, [<function record_decode_time at 0x1a1ac08>, <function after_draw_update_tray at 0x1a1ac80>])
2013-05-17 14:28:01,147 record_decode_time(True) wid=3, rgb24: 17x17, 2.4ms
2013-05-17 14:28:01,211 process_draw 4933 bytes for window 1 using x264 encoding with options={'quality': 1, 'frame': 1, 'speed': 20, 'csc_pixel_format': 0}
2013-05-17 14:28:01,211 draw_region(0, 0, 484, 316, x264, 4933 bytes, 1452, {'quality': 1, 'frame': 1, 'speed': 20, 'csc_pixel_format': 0}, [<function record_decode_time at 0x1a1ac08>, <function after_draw_refresh at 0x1a1ac80>])
2013-05-17 14:28:01,212 paint_with_video_decoder: new <type 'xpra.codecs.x264.decoder.Decoder'>(484,316,{'quality': 1, 'frame': 1, 'speed': 20, 'csc_pixel_format': 0})
2013-05-17 14:28:01,217 paint_with_video_decoder: options={'quality': 1, 'frame': 1, 'speed': 20, 'csc_pixel_format': 0}, decoder=<type 'xpra.codecs.x264.decoder.Decoder'>
2013-05-17 14:28:01,218 paint_with_video_decoder: options={'quality': 1, 'frame': 1, 'speed': 20, 'csc_pixel_format': 0}, decoder=<type 'xpra.codecs.x264.decoder.Decoder'>
[swscaler @ 0x7f9d78003400] Warning: data is not aligned! This can lead to a speedloss
2013-05-17 14:28:01,225 record_decode_time(True) wid=1, x264: 484x316, 14.0ms
2013-05-17 14:28:01,226 after_draw_refresh(True) 484x316 at 0x0 encoding=x264, options={'quality': 1, 'frame': 1, 'speed': 20, 'csc_pixel_format': 0}
2013-05-17 14:28:01,254 process_draw 3830 bytes for window 4 using x264 encoding with options={'quality': 1, 'frame': 1, 'speed': 20, 'csc_pixel_format': 0}
2013-05-17 14:28:01,254 draw_region(0, 0, 1140, 778, x264, 3830 bytes, 3420, {'quality': 1, 'frame': 1, 'speed': 20, 'csc_pixel_format': 0}, [<function record_decode_time at 0x1a1ac08>, <function after_draw_refresh at 0x1a1ac80>])
2013-05-17 14:28:01,255 paint_with_video_decoder: new <type 'xpra.codecs.x264.decoder.Decoder'>(1140,778,{'quality': 1, 'frame': 1, 'speed': 20, 'csc_pixel_format': 0})
2013-05-17 14:28:01,259 paint_with_video_decoder: options={'quality': 1, 'frame': 1, 'speed': 20, 'csc_pixel_format': 0}, decoder=<type 'xpra.codecs.x264.decoder.Decoder'>
2013-05-17 14:28:01,260 paint_with_video_decoder: options={'quality': 1, 'frame': 1, 'speed': 20, 'csc_pixel_format': 0}, decoder=<type 'xpra.codecs.x264.decoder.Decoder'>
2013-05-17 14:28:01,285 record_decode_time(True) wid=4, x264: 1140x778, 30.8ms
2013-05-17 14:28:01,286 after_draw_refresh(True) 1140x778 at 0x0 encoding=x264, options={'quality': 1, 'frame': 1, 'speed': 20, 'csc_pixel_format': 0}
2013-05-17 14:28:01,313 process_draw 56 bytes for window 4 using x264 encoding with options={'quality': 1, 'frame': 2, 'speed': 20, 'csc_pixel_format': 0}
2013-05-17 14:28:01,313 draw_region(0, 0, 1140, 778, x264, 56 bytes, 3420, {'quality': 1, 'frame': 2, 'speed': 20, 'csc_pixel_format': 0}, [<function record_decode_time at 0x1a1ac08>, <function after_draw_refresh at 0x1a1ac80>])
2013-05-17 14:28:01,314 paint_with_video_decoder: options={'quality': 1, 'frame': 2, 'speed': 20, 'csc_pixel_format': 0}, decoder=<type 'xpra.codecs.x264.decoder.Decoder'>
2013-05-17 14:28:01,314 paint_with_video_decoder: options={'quality': 1, 'frame': 2, 'speed': 20, 'csc_pixel_format': 0}, decoder=<type 'xpra.codecs.x264.decoder.Decoder'>
2013-05-17 14:28:01,346 record_decode_time(True) wid=4, x264: 1140x778, 32.7ms
2013-05-17 14:28:01,347 after_draw_refresh(True) 1140x778 at 0x0 encoding=x264, options={'quality': 1, 'frame': 2, 'speed': 20, 'csc_pixel_format': 0}
2013-05-17 14:28:01,467 process_draw 85 bytes for window 4 using png encoding with options={'store': 4}
2013-05-17 14:28:01,467 draw_region(0, 756, 1126, 1, png, 85 bytes, 3380, {'store': 4}, [<function record_decode_time at 0x1a1ac08>, <function after_draw_refresh at 0x1a1ac80>])
2013-05-17 14:28:01,475 draw error
Traceback (most recent call last):
  File "/mnt/data/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/ui_client_base.py", line 986, in _do_draw
    window.draw_region(x, y, width, height, coding, data, rowstride, packet_sequence, options, [record_decode_time])
  File "/mnt/data/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/client_window_base.py", line 251, in draw_region
    self._backing.draw_region(x, y, width, height, coding, img_data, rowstride, options, callbacks)
  File "/mnt/data/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/window_backing_base.py", line 277, in draw_region
    self.paint_image(coding, img_data, x, y, width, height, rowstride, options, callbacks)
  File "/mnt/data/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/gtk2/window_backing.py", line 40, in paint_image
    return GTKWindowBacking.paint_image(self, coding, img_data, x, y, width, height, rowstride, options, callbacks)
  File "/mnt/data/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/window_backing_base.py", line 133, in paint_image
    img_data = self.process_delta(raw_data, width, height, rowstride, options)
  File "/mnt/data/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/window_backing_base.py", line 104, in process_delta
    assert len(img_data) == rowstride * height, "expected %s bytes but received %s" % (rowstride * height, len(img_data))
AssertionError: expected 3380 bytes but received 3378
2013-05-17 14:28:01,479 error processing draw packet
Traceback (most recent call last):
  File "/mnt/data/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/ui_client_base.py", line 940, in _draw_thread_loop
    self._do_draw(packet)
  File "/mnt/data/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/ui_client_base.py", line 986, in _do_draw
    window.draw_region(x, y, width, height, coding, data, rowstride, packet_sequence, options, [record_decode_time])
  File "/mnt/data/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/client_window_base.py", line 251, in draw_region
    self._backing.draw_region(x, y, width, height, coding, img_data, rowstride, options, callbacks)
  File "/mnt/data/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/window_backing_base.py", line 277, in draw_region
    self.paint_image(coding, img_data, x, y, width, height, rowstride, options, callbacks)
  File "/mnt/data/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/gtk2/window_backing.py", line 40, in paint_image
    return GTKWindowBacking.paint_image(self, coding, img_data, x, y, width, height, rowstride, options, callbacks)
  File "/mnt/data/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/window_backing_base.py", line 133, in paint_image
    img_data = self.process_delta(raw_data, width, height, rowstride, options)
  File "/mnt/data/src/xpra/src/build/lib.linux-x86_64-2.7/xpra/client/window_backing_base.py", line 104, in process_delta
    assert len(img_data) == rowstride * height, "expected %s bytes but received %s" % (rowstride * height, len(img_data))
AssertionError: expected 3380 bytes but received 3378

Fri, 17 May 2013 13:02:11 GMT - ahuillet:

This appears to stem from an incorrect assumption of the output stride of a PNG-encoded image. The code currently expects the decompressed PNG image to have a stride matching the image before it was compressed, which is not necessarily the case.


Fri, 17 May 2013 14:09:03 GMT - Antoine Martin: status changed

rowstride confusion fixed in r3416 - does that fix your problems?


Fri, 17 May 2013 14:41:57 GMT - ahuillet: status changed; resolution set

Problem fixed, thanks!


Sat, 23 Jan 2021 04:52:07 GMT - migration script:

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