Alan Hamlett
2017-12-31 09:07:52 UTC
I'm seeing tracebacks in my Python Flask app when creating rows:
Traceback (most recent call last):
File "/opt/app/current/app/api.py", line 1174, in consume_heartbeat
Heartbeat.create(**form_data)
File "/opt/app/current/venv/lib/python3.4/site-packages/cassandra/cqlengine/models.py",
line 672, in create
return cls.objects.create(**kwargs)
File "/opt/app/current/venv/lib/python3.4/site-packages/cassandra/cqlengine/query.py",
line 977, in create
.using(connection=self._connection) \
File "/opt/app/current/venv/lib/python3.4/site-packages/cassandra/cqlengine/models.py",
line 738, in save
if_exists=self._if_exists).save()
File "/opt/app/current/venv/lib/python3.4/site-packages/cassandra/cqlengine/query.py",
line 1476, in save
self._execute(insert)
File "/opt/app/current/venv/lib/python3.4/site-packages/cassandra/cqlengine/query.py",
line 1351, in _execute
results = _execute_statement(self.model, statement,
self._consistency, self._timeout, connection=connection)
File "/opt/app/current/venv/lib/python3.4/site-packages/cassandra/cqlengine/query.py",
line 1505, in _execute_statement
return conn.execute(s, params, timeout=timeout, connection=connection)
File "/opt/app/current/venv/lib/python3.4/site-packages/cassandra/cqlengine/connection.py",
line 341, in execute
result = conn.session.execute(query, params, timeout=timeout)
File "cassandra/cluster.py", line 2122, in cassandra.cluster.Session.execute
File "cassandra/cluster.py", line 3982, in
cassandra.cluster.ResponseFuture.result
cassandra.cluster.NoHostAvailable: ('Unable to complete the operation
against any hosts', {})
I'm using the cassandra-driver client library 3.12.0 via Flask-CQLAlchemy
1.2.0 (https://github.com/thegeorgeous/flask-cqlalchemy) with uWSGI (
https://github.com/unbit/uwsgi).
cassandra.cqlengine.connection.setup is being passed lazy_connect=True and
retry_connect=Truecassandra.cqlengine because lazy_connect=False causes
requests to timeout to the Flask app for some reason.
Also seeing these errors in my uWSGI log file:
[control connection] Error connecting to 10.1.2.3: Traceback (most
recent call last): File "cassandra/cluster.py", line 2781, in
cassandra.cluster.ControlConnection._reconnect_internal File
"cassandra/cluster.py", line 2803, in
cassandra.cluster.ControlConnection._try_connect File
"cassandra/cluster.py", line 1195, in
cassandra.cluster.Cluster.connection_factory File
"cassandra/connection.py", line 341, in
cassandra.connection.Connection.factory cassandra.OperationTimedOut:
errors=Timed out creating connection (5 seconds), last_host=None
What's causing these connection and timeout errors? Something related to
Flask-CQLAlchemy?
Traceback (most recent call last):
File "/opt/app/current/app/api.py", line 1174, in consume_heartbeat
Heartbeat.create(**form_data)
File "/opt/app/current/venv/lib/python3.4/site-packages/cassandra/cqlengine/models.py",
line 672, in create
return cls.objects.create(**kwargs)
File "/opt/app/current/venv/lib/python3.4/site-packages/cassandra/cqlengine/query.py",
line 977, in create
.using(connection=self._connection) \
File "/opt/app/current/venv/lib/python3.4/site-packages/cassandra/cqlengine/models.py",
line 738, in save
if_exists=self._if_exists).save()
File "/opt/app/current/venv/lib/python3.4/site-packages/cassandra/cqlengine/query.py",
line 1476, in save
self._execute(insert)
File "/opt/app/current/venv/lib/python3.4/site-packages/cassandra/cqlengine/query.py",
line 1351, in _execute
results = _execute_statement(self.model, statement,
self._consistency, self._timeout, connection=connection)
File "/opt/app/current/venv/lib/python3.4/site-packages/cassandra/cqlengine/query.py",
line 1505, in _execute_statement
return conn.execute(s, params, timeout=timeout, connection=connection)
File "/opt/app/current/venv/lib/python3.4/site-packages/cassandra/cqlengine/connection.py",
line 341, in execute
result = conn.session.execute(query, params, timeout=timeout)
File "cassandra/cluster.py", line 2122, in cassandra.cluster.Session.execute
File "cassandra/cluster.py", line 3982, in
cassandra.cluster.ResponseFuture.result
cassandra.cluster.NoHostAvailable: ('Unable to complete the operation
against any hosts', {})
I'm using the cassandra-driver client library 3.12.0 via Flask-CQLAlchemy
1.2.0 (https://github.com/thegeorgeous/flask-cqlalchemy) with uWSGI (
https://github.com/unbit/uwsgi).
cassandra.cqlengine.connection.setup is being passed lazy_connect=True and
retry_connect=Truecassandra.cqlengine because lazy_connect=False causes
requests to timeout to the Flask app for some reason.
Also seeing these errors in my uWSGI log file:
[control connection] Error connecting to 10.1.2.3: Traceback (most
recent call last): File "cassandra/cluster.py", line 2781, in
cassandra.cluster.ControlConnection._reconnect_internal File
"cassandra/cluster.py", line 2803, in
cassandra.cluster.ControlConnection._try_connect File
"cassandra/cluster.py", line 1195, in
cassandra.cluster.Cluster.connection_factory File
"cassandra/connection.py", line 341, in
cassandra.connection.Connection.factory cassandra.OperationTimedOut:
errors=Timed out creating connection (5 seconds), last_host=None
What's causing these connection and timeout errors? Something related to
Flask-CQLAlchemy?