Defunct connection when internal query fails

Errors that occurred during wait_for_responses(), which is used by the
control connection and for preparing statements, were not causing the
connection to be closed or defuncted.
This commit is contained in:
Tyler Hobbs
2014-01-10 13:50:09 -06:00
parent ec38b81feb
commit fda6f29306
3 changed files with 14 additions and 3 deletions

View File

@@ -785,7 +785,6 @@ class Cluster(object):
self.control_connection.wait_for_schema_agreement(connection)
except Exception:
log.debug("Error waiting for schema agreement before preparing statements against host %s", host, exc_info=True)
# TODO: potentially error out the connection?
statements = self._prepared_statements.values()
for keyspace, ks_statements in groupby(statements, lambda s: s.keyspace):

View File

@@ -370,7 +370,13 @@ class AsyncoreConnection(Connection, asyncore.dispatcher):
raise OperationTimedOut()
time.sleep(0.01)
return waiter.deliver(timeout)
try:
return waiter.deliver(timeout)
except OperationTimedOut:
raise
except Exception, exc:
self.defunct(exc)
raise
def register_watcher(self, event_type, callback):
self._push_watchers[event_type].add(callback)

View File

@@ -418,7 +418,13 @@ class LibevConnection(Connection):
raise OperationTimedOut()
time.sleep(0.01)
return waiter.deliver(timeout)
try:
return waiter.deliver(timeout)
except OperationTimedOut:
raise
except Exception, exc:
self.defunct(exc)
raise
def register_watcher(self, event_type, callback):
self._push_watchers[event_type].add(callback)