Hello,
I’m using requests library for python to save points into influxdb and we are suffering timeouts.
We implemented tenacity with 5 retries and we use requests with 10 second timeout, but still we are suffering from timeouts.
What could be going on?
The host is marty-300d7f91.influxcloud.net
Thanks in advance
File "/env/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 426, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/env/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 421, in _make_request
httplib_response = conn.getresponse()
File "/opt/python3.7/lib/python3.7/http/client.py", line 1369, in getresponse
response.begin()
File "/opt/python3.7/lib/python3.7/http/client.py", line 310, in begin
version, status, reason = self._read_status()
File "/opt/python3.7/lib/python3.7/http/client.py", line 271, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/opt/python3.7/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
File "/opt/python3.7/lib/python3.7/ssl.py", line 1071, in recv_into
return self.read(nbytes, buffer)
File "/opt/python3.7/lib/python3.7/ssl.py", line 929, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/env/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/env/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 725, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/env/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 403, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/env/local/lib/python3.7/site-packages/urllib3/packages/six.py", line 735, in reraise
raise value
File "/env/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen
chunked=chunked,
File "/env/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 428, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
File "/env/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 336, in _raise_timeout
self, url, "Read timed out. (read timeout=%s)" % timeout_value
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='marty-300d7f91.influxcloud.net', port=8086): Read timed out. (read timeout=10)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/env/local/lib/python3.7/site-packages/google/cloud/functions/worker_v2.py", line 449, in run_background_function
_function_handler.invoke_user_function(event_object)
File "/env/local/lib/python3.7/site-packages/google/cloud/functions/worker_v2.py", line 268, in invoke_user_function
return call_user_function(request_or_event)
File "/env/local/lib/python3.7/site-packages/google/cloud/functions/worker_v2.py", line 265, in call_user_function
event_context.Context(**request_or_event.context))
File "/user_code/main.py", line 10, in function_entry_point
return collector_agent(event, context)
File "/user_code/data_ingestion/app.py", line 89, in collector_agent
[datapoint],
File "/user_code/data_ingestion/app.py", line 181, in write_datapoint_to_influx_db
stop=(stop_after_delay(10) | stop_after_attempt(5)), reraise=True
File "/env/local/lib/python3.7/site-packages/tenacity/__init__.py", line 382, in __iter__
do = self.iter(retry_state=retry_state)
File "/env/local/lib/python3.7/site-packages/tenacity/__init__.py", line 360, in iter
raise retry_exc.reraise()
File "/env/local/lib/python3.7/site-packages/tenacity/__init__.py", line 193, in reraise
raise self.last_attempt.result()
File "/opt/python3.7/lib/python3.7/concurrent/futures/_base.py", line 428, in result
return self.__get_result()
File "/opt/python3.7/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/user_code/data_ingestion/app.py", line 189, in write_datapoint_to_influx_db
timeout=10,
File "/env/local/lib/python3.7/site-packages/requests/sessions.py", line 578, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/env/local/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "/env/local/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "/env/local/lib/python3.7/site-packages/requests/adapters.py", line 529, in send
raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='marty-300d7f91.influxcloud.net', port=8086): Read timed out. (read timeout=10)