Merge "Don't force_reconnect() on unhandled Idl exception"

This commit is contained in:
Zuul 2022-10-25 03:11:18 +00:00 committed by Gerrit Code Review
commit fd6dab160d
1 changed files with 2 additions and 15 deletions

View File

@ -93,7 +93,6 @@ class Connection(object):
self.thread.start()
def run(self):
errors = 0
while self.is_running:
# If we fail in an Idl call, we could have missed an update
# from the server, leaving us out of sync with ovsdb-server.
@ -108,22 +107,10 @@ class Connection(object):
self.idl.run()
except Exception as e:
# This shouldn't happen, but is possible if there is a bug
# in python-ovs
errors += 1
# in python-ovs, or an unhandled exception in overridden
# Idl.notify() code
LOG.exception(e)
with self.lock:
self.idl.force_reconnect()
try:
idlutils.wait_for_change(self.idl, self.timeout)
except Exception as e:
# This could throw the same exception as idl.run()
# or Exception("timeout"), either way continue
LOG.exception(e)
sleep = min(2 ** errors, 60)
LOG.info("Trying to recover, sleeping %s seconds", sleep)
time.sleep(sleep)
continue
errors = 0
txn = self.txns.get_nowait()
if txn is not None:
try: