Potential infinite loop in adapter with high frequency polling rate <=1s
I think this is caused by the auth behaviour.
If the adapter already has a valid token it uses it. If not it does a token exchange. The token exchange over real internet will take >1s so when the next request is made it still won't have a token and will start the auth cycle again.
I would have thought this would be a brief spike and then resolve but maybe not.
I wondered about the retry behaviour but it only retries requests once and only if the status code is 403/503.
stack trace
Traceback (most recent call last):
File "/Users/VictorDarvariu/local/miniforge3/envs/mas-dt/lib/python3.11/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/VictorDarvariu/local/miniforge3/envs/mas-dt/lib/python3.11/site-packages/urllib3/util/connection.py", line 95, in create_connection
raise err
File "/Users/VictorDarvariu/local/miniforge3/envs/mas-dt/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection
sock.connect(sa)
OSError: [Errno 12] Cannot allocate memory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/VictorDarvariu/local/miniforge3/envs/mas-dt/lib/python3.11/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "/Users/VictorDarvariu/local/miniforge3/envs/mas-dt/lib/python3.11/site-packages/urllib3/connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "/Users/VictorDarvariu/local/miniforge3/envs/mas-dt/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
conn.connect()
File "/Users/VictorDarvariu/local/miniforge3/envs/mas-dt/lib/python3.11/site-packages/urllib3/connection.py", line 358, in connect
self.sock = conn = self._new_conn()
^^^^^^^^^^^^^^^^
File "/Users/VictorDarvariu/local/miniforge3/envs/mas-dt/lib/python3.11/site-packages/urllib3/connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x169e79b90>: Failed to establish a new connection: [Errno 12] Cannot allocate memory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/VictorDarvariu/local/miniforge3/envs/mas-dt/lib/python3.11/site-packages/requests/adapters.py", line 667, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File "/Users/VictorDarvariu/local/miniforge3/envs/mas-dt/lib/python3.11/site-packages/urllib3/connectionpool.py", line 787, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File "/Users/VictorDarvariu/local/miniforge3/envs/mas-dt/lib/python3.11/site-packages/urllib3/util/retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='nucleus.noc.ac.uk', port=443): Max retries exceeded with url: /playground/api//receive (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x169e79b90>: Failed to establish a new connection: [Errno 12] Cannot allocate memory'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/VictorDarvariu/git/gliders/glider-mission-planning/src/noc_backbone_integration/receiver.py", line 108, in <module>
main()
File "/Users/VictorDarvariu/git/gliders/glider-mission-planning/src/noc_backbone_integration/receiver.py", line 104, in main
glider_planning_service.execute_main_loop()
File "/Users/VictorDarvariu/git/gliders/glider-mission-planning/src/noc_backbone_integration/receiver.py", line 33, in execute_main_loop
the_response = self.soar_adapter.poll()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/VictorDarvariu/local/miniforge3/envs/mas-dt/lib/python3.11/site-packages/backbone_adapter/adapter.py", line 50, in poll
response = requests.get(url=f"{api_root}/receive", headers=headers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/VictorDarvariu/local/miniforge3/envs/mas-dt/lib/python3.11/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/VictorDarvariu/local/miniforge3/envs/mas-dt/lib/python3.11/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/VictorDarvariu/local/miniforge3/envs/mas-dt/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/VictorDarvariu/local/miniforge3/envs/mas-dt/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/VictorDarvariu/local/miniforge3/envs/mas-dt/lib/python3.11/site-packages/requests/adapters.py", line 700, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='nucleus.noc.ac.uk', port=443): Max retries exceeded with url: /playground/api//receive (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x169e79b90>: Failed to establish a new connection: [Errno 12] Cannot allocate memory'))