Skip to content

Commit

Permalink
Fix a possible stack in on_nodes_info_change()
Browse files Browse the repository at this point in the history
Test existance of smon before use.
  • Loading branch information
cvaroqui committed Oct 23, 2020
1 parent cd04db2 commit 3da0a32
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion opensvc/daemon/shared.py
Expand Up @@ -1436,10 +1436,13 @@ def on_nodes_info_change(self):
continue
svc.unset_conf_lazy()
if self.get_node_monitor().status != "init":
smon = self.daemon_status_data.get(["monitor", "nodes", Env.nodename, "services", "status", path, "monitor"], None)
if not smon:
continue
try:
# trigger status.json reload by the mon thread
data = svc.print_status_data_eval(refresh=False, write_data=True, clear_rstatus=True)
data["monitor"] = self.daemon_status_data.get(["monitor", "nodes", Env.nodename, "services", "status", path, "monitor"])
data["monitor"] = smon
self.daemon_status_data.set(["monitor", "nodes", Env.nodename, "services", "status", path], data)
except Exception as exc:
self.log.error("on nodes info change, object %s status refresh:", path)
Expand Down

0 comments on commit 3da0a32

Please sign in to comment.