Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZeroDivisionError in get_best_nonvideo_encoding #1121

Closed
totaam opened this issue Feb 16, 2016 · 9 comments
Closed

ZeroDivisionError in get_best_nonvideo_encoding #1121

totaam opened this issue Feb 16, 2016 · 9 comments

Comments

@totaam
Copy link
Collaborator

totaam commented Feb 16, 2016

Issue migrated from trac ticket # 1121

component: server | priority: major | resolution: fixed

2016-02-16 07:54:05: antoine created the issue


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
@totaam
Copy link
Collaborator Author

totaam commented Feb 16, 2016

2016-02-16 08:55:51: antoine changed status from new to closed

@totaam
Copy link
Collaborator Author

totaam commented Feb 16, 2016

2016-02-16 08:55:51: antoine set resolution to fixed

@totaam
Copy link
Collaborator Author

totaam commented Feb 16, 2016

2016-02-16 08:55:51: antoine commented


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

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

@totaam
Copy link
Collaborator Author

totaam commented Feb 19, 2016

2016-02-19 16:09:02: antoine changed status from closed to reopened

@totaam
Copy link
Collaborator Author

totaam commented Feb 19, 2016

2016-02-19 16:09:02: antoine removed resolution (was fixed)

@totaam
Copy link
Collaborator Author

totaam commented Feb 19, 2016

2016-02-19 16:09:02: antoine commented


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

@totaam
Copy link
Collaborator Author

totaam commented Mar 16, 2016

2016-03-16 05:39:49: antoine changed status from reopened to closed

@totaam
Copy link
Collaborator Author

totaam commented Mar 16, 2016

2016-03-16 05:39:49: antoine set resolution to fixed

@totaam
Copy link
Collaborator Author

totaam commented Mar 16, 2016

2016-03-16 05:39:49: antoine commented


Not ideal, but closing for now.

@totaam totaam closed this as completed Mar 16, 2016
@totaam totaam added the v0.14.x label Jan 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant