From 5942aa50fc6fdb7991019d383d6fb3936afb4b46 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Mon, 3 Oct 2022 14:04:12 -0400 Subject: [PATCH] Avoid raise/handle deadlocks Can cause log flooding in some edge cases and isn't really needed any longer. Use a proper conditional followed by an actual error handler. --- node-daemon/pvcnoded/util/keepalive.py | 30 ++++++++++++++++---------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/node-daemon/pvcnoded/util/keepalive.py b/node-daemon/pvcnoded/util/keepalive.py index 735eb948..d1b052f6 100644 --- a/node-daemon/pvcnoded/util/keepalive.py +++ b/node-daemon/pvcnoded/util/keepalive.py @@ -661,15 +661,19 @@ def node_keepalive(logger, config, zkhandler, this_node): zkhandler.read("base.config.migration_target_selector") != config["migration_target_selector"] ): - raise + zkhandler.write( + [ + ( + "base.config.migration_target_selector", + config["migration_target_selector"], + ) + ] + ) except Exception: - zkhandler.write( - [ - ( - "base.config.migration_target_selector", - config["migration_target_selector"], - ) - ] + logger.out( + "Failed to set migration target selector in Zookeeper", + state="e", + prefix="main-thread", ) # Set the upstream IP in Zookeeper for clients to read @@ -680,10 +684,14 @@ def node_keepalive(logger, config, zkhandler, this_node): zkhandler.read("base.config.upstream_ip") != config["upstream_floating_ip"] ): - raise + zkhandler.write( + [("base.config.upstream_ip", config["upstream_floating_ip"])] + ) except Exception: - zkhandler.write( - [("base.config.upstream_ip", config["upstream_floating_ip"])] + logger.out( + "Failed to set upstream floating IP in Zookeeper", + state="e", + prefix="main-thread", ) # Get past state and update if needed