Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

Enabling network statistics crashes Tribler #105

Closed
qstokkink opened this issue Aug 2, 2024 · 1 comment · Fixed by #113
Closed

Enabling network statistics crashes Tribler #105

qstokkink opened this issue Aug 2, 2024 · 1 comment · Fixed by #113
Assignees
Labels
bug Something isn't working

Comments

@qstokkink
Copy link
Owner

Clicking the enable statistics setting and then restarting causes the following crash:

Traceback (most recent call last):
  File "src/run_tribler.py", line 105, 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 "src/run_tribler.py", line 86, in main
    session = Session(config)
  File "src/tribler/core/session.py", line 88, in __init__
    self.ipv8 = IPv8(self.config.get("ipv8"), enable_statistics=self.config.get("statistics"))
  File "pyipv8/ipv8_service.py", line 108, in __init__
    self.endpoint = DispatcherEndpoint(list(endpoint_args.keys()), **endpoint_args)
  File "pyipv8/ipv8/messaging/interfaces/dispatcher/endpoint.py", line 91, in __init__
    self.interfaces = {interface: INTERFACES[interface](**(kwargs.get(interface, {}))) for interface in interfaces}
  File "pyipv8/ipv8/messaging/interfaces/dispatcher/endpoint.py", line 91, in <dictcomp>
    self.interfaces = {interface: INTERFACES[interface](**(kwargs.get(interface, {}))) for interface in interfaces}
TypeError: UDPEndpoint.__init__() got an unexpected keyword argument 'worker_threads'
@qstokkink qstokkink added the bug Something isn't working label Aug 2, 2024
@qstokkink
Copy link
Owner Author

I think the following happens:

  1. Tribler runs with Rust enhancements. The worker_threads setting is saved:

ifc["worker_threads"] = session.config.get("tunnel_community/max_circuits")

  1. The statistics are enabled and Tribler is restarted. The nullcontext does not do anything because the statistics are incompatible with the Rust enhancements and Tribler crashes due to the leftover setting.

with nullcontext() if self.config.get("statistics") else rust_enhancements(self):
self.ipv8 = IPv8(self.config.get("ipv8"), enable_statistics=self.config.get("statistics"))


If the Rust enhancements are not available at all, we do properly clean the config setting:

except ImportError:
logger.info("Rust endpoint not found (pip install ipv8-rust-tunnels).")
for ifc in session.config.configuration["ipv8"]["interfaces"]:
if ifc["interface"] == "UDPIPv4":
ifc.pop("worker_threads")

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

Successfully merging a pull request may close this issue.

1 participant