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

Crash after restarting Tribler #8090

Closed
qstokkink opened this issue Aug 14, 2024 · 5 comments · Fixed by #8091
Closed

Crash after restarting Tribler #8090

qstokkink opened this issue Aug 14, 2024 · 5 comments · Fixed by #8091

Comments

@qstokkink
Copy link
Contributor

Starting the second time after starting Tribler with a fresh configuration.json, Tribler keeps crashing.

INFO:__main__:Run Tribler: {'torrent': '', 'log_level': 'INFO'}
INFO:__main__:Root state dir: /home/quinten/.Tribler
INFO:tribler.tribler_config:Load: /home/quinten/.Tribler/git/configuration.json.
INFO:__main__:Creating session. API port: 0. API key: 82a6982ee20521dcef29adbbea3adc65.
Traceback (most recent call last):
  File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1073, in _wrap_create_connection
    sock = await aiohappyeyeballs.start_connection(
  File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/aiohappyeyeballs/impl.py", line 104, in start_connection
    raise first_exception
  File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/aiohappyeyeballs/impl.py", line 81, in start_connection
    sock = await _connect_sock(
  File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/aiohappyeyeballs/impl.py", line 166, in _connect_sock
    await loop.sock_connect(sock, address)
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 501, in sock_connect
    return await fut
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 541, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 38165)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/quinten/Documents/tribler/src/run_tribler.py", line 137, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/quinten/Documents/tribler/src/run_tribler.py", line 102, in main
    server_url = await session.find_api_server()
  File "/home/quinten/Documents/tribler/src/tribler/core/session.py", line 182, in find_api_server
    if await _is_url_available(http_url):
  File "/home/quinten/Documents/tribler/src/tribler/core/session.py", line 83, in _is_url_available
    async with session.get(url, timeout=timeout):
  File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/aiohttp/client.py", line 1353, in __aenter__
    self._resp = await self._coro
  File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/aiohttp/client.py", line 657, in _request
    conn = await self._connector.connect(
  File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/aiohttp/connector.py", line 564, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/aiohttp/connector.py", line 975, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1350, in _create_direct_connection
    raise last_exc
  File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1319, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1088, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 127.0.0.1:38165 ssl:default [Connect call failed ('127.0.0.1', 38165)]
@qstokkink
Copy link
Contributor Author

I found a workaround that doesn't require me to delete my configuration every time: setting http_port_running to 0 after shutting down Tribler.

@hbiyik
Copy link

hbiyik commented Oct 2, 2024

@qstokkink

i still get the same error from the git main branch.
i am running arch btw :)

Traceback (most recent call last):
  File "/home/boogie/.local/lib/python3.10/site-packages/aiohttp/connector.py", line 1073, in _wrap_create_connection
    sock = await aiohappyeyeballs.start_connection(
  File "/home/boogie/.local/lib/python3.10/site-packages/aiohappyeyeballs/impl.py", line 122, in start_connection
    raise OSError(first_errno, msg)
ConnectionRefusedError: [Errno 111] Multiple exceptions: [Errno 111] Connect call failed ('::1', 5173, 0, 0), [Errno 111] Connect call failed ('127.0.0.1', 5173)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/boogie/src/tribler/src/tribler/core/restapi/rest_manager.py", line 106, in error_middleware
    response = await handler(request)
  File "/home/boogie/src/tribler/src/tribler/core/restapi/rest_manager.py", line 161, in required_components_middleware
    return await handler(request)
  File "/home/boogie/.local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
  File "/home/boogie/src/tribler/src/tribler/core/restapi/webui_endpoint.py", line 36, in return_files
    async with self.session.get(f'http://localhost:5173/{path}') as response:
  File "/home/boogie/.local/lib/python3.10/site-packages/aiohttp/client.py", line 1353, in __aenter__
    self._resp = await self._coro
  File "/home/boogie/.local/lib/python3.10/site-packages/aiohttp/client.py", line 657, in _request
    conn = await self._connector.connect(
  File "/home/boogie/.local/lib/python3.10/site-packages/aiohttp/connector.py", line 564, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/home/boogie/.local/lib/python3.10/site-packages/aiohttp/connector.py", line 975, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/home/boogie/.local/lib/python3.10/site-packages/aiohttp/connector.py", line 1350, in _create_direct_connection
    raise last_exc
  File "/home/boogie/.local/lib/python3.10/site-packages/aiohttp/connector.py", line 1319, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/home/boogie/.local/lib/python3.10/site-packages/aiohttp/connector.py", line 1088, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host localhost:5173 ssl:default [Multiple exceptions: [Errno 111] Connect call failed ('::1', 5173, 0, 0), [Errno 111] Connect call failed ('127.0.0.1', 5173)]

@qstokkink
Copy link
Contributor Author

@hbiyik Thanks for testing! I want to revive Arch support in the next minor 8.1.x releases (#6740, #6739), and also proper multiplatform releases in general (#8171, #5345, #5327) using GitHub Actions: I've been going through your buildsys repository again 🙂 Anyway, for now, disclaimer: Arch may be a bit of a rocky experience.

It looks like you didn't perform the npm run build step, step 3 of the docs. Is that correct?

@hbiyik
Copy link

hbiyik commented Oct 4, 2024

i hadnt done the npm build, but after building the ts still get the same error. May be i should just put some debugger in it.

PS: that buildsys should be quite irrelevant now but the ideas might in it might live on.

@qstokkink
Copy link
Contributor Author

If you want to debug this, the following line looks for the dist folder and puts you in "developer" mode if it cannot be found:

self.has_dist = (self.webui_root / "dist").exists()
self.session = ClientSession() if not self.has_dist else None

The webui_root is defined here:

return pathlib.Path(__file__).parent.absolute() / "ui"

Normally, this should be looking for src/tribler/ui/dist. You could try using my dist (built for commit ca82531) and putting it in that directory:

dist.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants