Merge "Don't force_reconnect() on unhandled Idl exception"
This commit is contained in:
commit
fd6dab160d
@ -93,7 +93,6 @@ class Connection(object):
|
|||||||
self.thread.start()
|
self.thread.start()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
errors = 0
|
|
||||||
while self.is_running:
|
while self.is_running:
|
||||||
# If we fail in an Idl call, we could have missed an update
|
# If we fail in an Idl call, we could have missed an update
|
||||||
# from the server, leaving us out of sync with ovsdb-server.
|
# from the server, leaving us out of sync with ovsdb-server.
|
||||||
@ -108,22 +107,10 @@ class Connection(object):
|
|||||||
self.idl.run()
|
self.idl.run()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# This shouldn't happen, but is possible if there is a bug
|
# This shouldn't happen, but is possible if there is a bug
|
||||||
# in python-ovs
|
# in python-ovs, or an unhandled exception in overridden
|
||||||
errors += 1
|
# Idl.notify() code
|
||||||
LOG.exception(e)
|
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
|
continue
|
||||||
errors = 0
|
|
||||||
txn = self.txns.get_nowait()
|
txn = self.txns.get_nowait()
|
||||||
if txn is not None:
|
if txn is not None:
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user