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

mgr/dashboard: Fix data race and use-before-assignment #21590

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/pybind/mgr/dashboard/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,21 @@ def __init__(self, view, fn, args, kwargs):

# pylint: disable=broad-except
def run(self):
t0 = 0
t1 = 0
try:
t0 = time.time()
logger.debug("VC: starting execution of %s", self.fn)
val = self.fn(*self.args, **self.kwargs)
t1 = time.time()
except Exception as ex:
logger.exception("Error while calling fn=%s ex=%s", self.fn,
str(ex))
self._view.value = None
self._view.value_when = None
self._view.getter_thread = None
self._view.exception = ex
with self._view.lock:
logger.exception("Error while calling fn=%s ex=%s", self.fn,
str(ex))
self._view.value = None
self._view.value_when = None
self._view.getter_thread = None
self._view.exception = ex
else:
with self._view.lock:
self._view.latency = t1 - t0
Expand Down