xpra icon
Bug tracker and wiki

Opened 4 years ago

Closed 4 years ago

#1121 closed defect (fixed)

ZeroDivisionError in get_best_nonvideo_encoding

Reported by: Antoine Martin Owned by: Antoine Martin
Priority: major Milestone: 0.17
Component: server Version: 0.14.x
Keywords: Cc:

Description

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

Change History (3)

comment:1 Changed 4 years ago by Antoine Martin

Resolution: fixed
Status: newclosed

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

  • clobbering the local variable by applying the mask could cause a zero dimension to be passed to the get_best_nonvideo_encoding method, causing the ZeroDivisionError
  • a similar bug could make us fail to match the video region with the dimensions given (we now always apply the mask to both sets of dimensions before comparing)

comment:2 Changed 4 years ago by Antoine Martin

Resolution: fixed
Status: closedreopened

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

comment:3 Changed 4 years ago by Antoine Martin

Resolution: fixed
Status: reopenedclosed

Not ideal, but closing for now.

Note: See TracTickets for help on using tickets.