Read timed out. (read timeout=None)
See original GitHub issuepython-arango: 6.1.0 ArangoDB: 3.7.6 Community Edition
When I Execute the next query:
db = ArangoConnection.db()
periodo_cursor = db.aql.execute('''
FOR t in Periodo
RETURN t
''')
Sometimes I have the next error:
Traceback (most recent call last): File “/Users/isaacfi/Code/eneounam.sip/backend/venv/lib/python3.7/site-packages/flask/app.py”, line 1832, in full_dispatch_request rv = self.dispatch_request() File “/Users/isaacfi/Code/eneounam.sip/backend/venv/lib/python3.7/site-packages/flask/app.py”, line 1818, in dispatch_request return self.view_functionsrule.endpoint File “/Users/isaacfi/Code/eneounam.sip/backend/venv/lib/python3.7/site-packages/flasgger/utils.py”, line 255, in wrapper return function(*args, **kwargs) File “/Users/isaacfi/Code/eneounam.sip/backend/controllers/catalogs_controller.py”, line 115, in get_periodos lastUpdateDate) File “/Users/isaacfi/Code/eneounam.sip/backend/business/catalogs/periodo_business.py”, line 41, in get_periodos ‘’', bind_vars=bind_vars) File “/Users/isaacfi/Code/eneounam.sip/backend/venv/lib/python3.7/site-packages/arango/aql.py”, line 293, in execute return self._execute(request, response_handler) File “/Users/isaacfi/Code/eneounam.sip/backend/venv/lib/python3.7/site-packages/arango/api.py”, line 66, in _execute return self._executor.execute(request, response_handler) File “/Users/isaacfi/Code/eneounam.sip/backend/venv/lib/python3.7/site-packages/arango/executor.py”, line 81, in execute resp = self._conn.send_request(request) File “/Users/isaacfi/Code/eneounam.sip/backend/venv/lib/python3.7/site-packages/arango/connection.py”, line 250, in send_request auth=self._auth File “/Users/isaacfi/Code/eneounam.sip/backend/venv/lib/python3.7/site-packages/arango/http.py”, line 109, in send_request auth=auth File “/Users/isaacfi/Code/eneounam.sip/backend/venv/lib/python3.7/site-packages/requests/sessions.py”, line 533, in request resp = self.send(prep, **send_kwargs) File “/Users/isaacfi/Code/eneounam.sip/backend/venv/lib/python3.7/site-packages/requests/sessions.py”, line 646, in send r = adapter.send(request, **kwargs) File “/Users/isaacfi/Code/eneounam.sip/backend/venv/lib/python3.7/site-packages/requests/adapters.py”, line 529, in send raise ReadTimeout(e, request=request) requests.exceptions.ReadTimeout: HTTPConnectionPool(host=‘132.247.114.25’, port=8529): Read timed out. (read timeout=None)
This usually happends when the server is useless for a while (2 mins approx).
This is how I create the arango client:
from arango import ArangoClient
from arango.database import StandardDatabase
from settings import ARANGO_DB, ARANGO_HOSTS, ARANGO_PASSWORD, ARANGO_USER
class ArangoConnection:
_db: StandardDatabase = None
@staticmethod
def db() -> StandardDatabase:
"""Connection to SIP
:return: Arango database connection to SIP
:rtype: StandardDatabase
"""
if ArangoConnection._db is None:
arango_client = ArangoClient(hosts=ARANGO_HOSTS)
ArangoConnection._db = arango_client.db(
ARANGO_DB, ARANGO_USER, ARANGO_PASSWORD)
return ArangoConnection._db
BR.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top GitHub Comments
I was able to solve the issue setting up the session and requests as follow:
Where the setting values are:
ARANGO_HOSTS=http://localhost… ARANGO_CONNECT_TIMEOUT=30 ARANGO_READ_TIMEOUT=60 ARANGO_MAX_TRIES=5
BR.
Hi @joowani
The issue still appears only in development mode when I run my flask application. But you gave me an idea to manage the sessions with the custom http client and I may fix the problem.
Thank you