Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: topology request during setup is blocking the MainThread, hanging until timeout #75

Open
viniarck opened this issue Nov 7, 2024 · 0 comments · May be fixed by #77
Open

bug: topology request during setup is blocking the MainThread, hanging until timeout #75

viniarck opened this issue Nov 7, 2024 · 0 comments · May be fixed by #77
Labels
bug Something isn't working

Comments

@viniarck
Copy link
Collaborator

viniarck commented Nov 7, 2024

On setup(), it's trying to make a request to topology, which is blocking the MainThread, since all of this is bootstrapped on it, so the API server and uvicorn wouldn't be able since this would yield control to the event loop since this part is shared. On setup() only DB calls or requests to other resources that don't depend on kytos, ultimatel, this request would timeout:

2024-11-07 11:06:54,403 - INFO [kytos.core.controller] (MainThread) Loading NApp kytos/sdx
2024-11-07 11:07:24,440 - ERROR [kytos.napps.kytos/sdx] (MainThread) HTTPConnectionPool(host='127.0.0.1', port=8181): Read timed out. (read timeout=30)
Traceback (most recent call last):
  File "/home/viniarck/repos/kytos/.direnv/python-3.11/lib/python3.11/site-packages/urllib3/connectionpool.py", line 467, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/home/viniarck/repos/kytos/.direnv/python-3.11/lib/python3.11/site-packages/urllib3/connectionpool.py", line 462, in _make_request
    httplib_response = conn.getresponse()
                       ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 1395, in getresponse
    response.begin()
  File "/usr/lib/python3.11/http/client.py", line 325, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 286, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/socket.py", line 706, in readinto
    return self._sock.recv_into(b)
           ^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: timed out

Ultimately, what you probably want here is to only try to load the topology when kytos/topology.topology_loaded is received, since that event won't be lost, even if topology starts first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant