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
pybind/mgr: ceph osd status crash with ZeroDivisionError #44752
Conversation
cf700ea
to
02d9e03
Compare
src/pybind/mgr/status/module.py
Outdated
@@ -24,7 +24,7 @@ def get_latest(self, daemon_type: str, daemon_name: str, stat: str) -> int: | |||
|
|||
def get_rate(self, daemon_type: str, daemon_name: str, stat: str) -> int: | |||
data = self.get_counter(daemon_type, daemon_name, stat)[stat] | |||
if data and len(data) > 1 and data[-1][0] != data[-2][0]: | |||
if data and len(data) > 1 and int(data[-1][0] - data[-2][0]) != 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even if the operator prec. is correct - can you add '()' for legibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. thanks
02d9e03
to
12d8535
Compare
@NitzanMordhai : I made some changes to the PR message. You might want to consider the revised text |
If stats-update is called a second time within a second, get_rate() fails with a 'divide by 0' error. Change the check before the computation, taking into account the fact that two f.p numbers may differ, but still their diff - when cast into an int - might be zero. Fixed: https://tracker.ceph.com/issues/53538 Signed-off-by: Nitzan Mordechai <nmordech@redhat.com>
12d8535
to
140b7ce
Compare
@ronen-fr I copied the text changes into the commit |
have you tried using ceph/src/pybind/mgr/mgr_util.py Line 665 in 82219b3
|
@sebastian-philipp the original function worked fine, the only change was the check before return, the conversion to int caused value lower then 1 to divide by zero |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: s/Fixed/Fixes/ in the commit message
If stats-update is called a second time within a second, get_rate() fails with
a 'divide by 0' error.
Change the check before the computation, taking into account the fact that
two f.p numbers may differ, but still their diff - when cast into an int - might
be zero.
Fixed: https://tracker.ceph.com/issues/53538
Signed-off-by: Nitzan Mordechai nmordech@redhat.com
Checklist
Show available Jenkins commands
jenkins retest this please
jenkins test classic perf
jenkins test crimson perf
jenkins test signed
jenkins test make check
jenkins test make check arm64
jenkins test submodules
jenkins test dashboard
jenkins test dashboard cephadm
jenkins test api
jenkins test docs
jenkins render docs
jenkins test ceph-volume all
jenkins test ceph-volume tox