Xpra: Ticket #1121: ZeroDivisionError in get_best_nonvideo_encoding

Seen this a few times on a 0.14.34 server:

Traceback (most recent call last):
  File "/usr/lib64/python2.6/site-packages/xpra/x11/server.py", line 602, in _contents_changed
    self._damage(window, event.x, event.y, event.width, event.height)
  File "/usr/lib64/python2.6/site-packages/xpra/server/server_base.py", line 1636, in _damage
    ss.damage(wid, window, x, y, width, height, options)
  File "/usr/lib64/python2.6/site-packages/xpra/server/source.py", line 1577, in damage
    ws.damage(window, x, y, w, h, damage_options)
  File "/usr/lib64/python2.6/site-packages/xpra/server/window_source.py", line 740, in damage
    actual_encoding = self.get_best_encoding(w*h, ww, wh, s, q, self.encoding)
  File "/usr/lib64/python2.6/site-packages/xpra/server/window_video_source.py", line 298, in get_best_encoding_video
    return nonvideo()
  File "/usr/lib64/python2.6/site-packages/xpra/server/window_video_source.py", line 277, in nonvideo
    return self.get_best_nonvideo_encoding(pixel_count, ww, wh, s, q, self.non_video_encodings[0], self.non_video_encodings)
  File "/usr/lib64/python2.6/site-packages/xpra/server/window_video_source.py", line 352, in get_best_nonvideo_encoding
    lossless_q = min(100, self._lossless_threshold_base + self._lossless_threshold_pixel_boost * pixel_count / (ww*wh))
ZeroDivisionError: integer division or modulo by zero


Tue, 16 Feb 2016 08:55:50 GMT - Antoine Martin: status changed; resolution set

Big bug alert - fix in r11945 with backport for all branches in r11952


Fri, 19 Feb 2016 16:09:01 GMT - Antoine Martin: status changed; resolution deleted

Saw it again with the fix applied... And with this message:

Uh-oh, our size doesn't fit window sizing constraints: 0x0 vs 25x17

So the problem actually comes from the window dimensions. Which can be used if we decide to do a full window update - which is likely when the window is small. And 0x0 is very small..

So r12001 takes the brutal approach and skips the damage if the window size is zero, but it would be better to figure out how we got there...


Wed, 16 Mar 2016 05:39:48 GMT - Antoine Martin: status changed; resolution set

Not ideal, but closing for now.


Sat, 23 Jan 2021 05:15:33 GMT - migration script:

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