Slow coroutine execution: 18.317 seconds,
<Task pending name='Task-9' coro=<Component.start() running at src\<relief>\core\components\component.py:42> cb=[gather.<locals>._done_callback() at C:\Users\<relief>\AppData\Local\Programs\Python\Python38\lib\asyncio\tasks.py:751]>,
Traceback (most recent call last):,
File "src\<relief>\core\start_core.py", line 206, in run_core (function started 22.815 seconds ago),
File "src\<relief>\core\start_core.py", line 169, in run_tribler_core_session (function started 21.971 seconds ago),
File "C:\Users\<relief>\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 603, in run_until_complete (function started 21.928 seconds ago),
File "C:\Users\<relief>\AppData\Local\Programs\Python\Python38\lib\asyncio\windows_events.py", line 316, in run_forever (function started 21.928 seconds ago),
File "C:\Users\<relief>\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 570, in run_forever (function started 21.928 seconds ago),
File "C:\Users\<relief>\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 1859, in _run_once (function started 18.317 seconds ago),
File "src\<relief>\core\utilities\slow_coro_detection\patch.py", line 37, in patched_handle_run (function started 18.317 seconds ago),
File "C:\Users\<relief>\AppData\Local\Programs\Python\Python38\lib\asyncio\events.py", line 81, in _run (function started 18.317 seconds ago),
File "src\<relief>\core\components\component.py", line 42, in start (function started 18.317 seconds ago),
File "src\<relief>\core\components\libtorrent\libtorrent_component.py", line 31, in run (function started 18.317 seconds ago),
File "src\<relief>\core\components\libtorrent\download_manager\download_manager.py", line 150, in initialize (function started 18.316 seconds ago),
File "src\<relief>\core\components\libtorrent\download_manager\download_manager.py", line 340, in get_session (function started 18.316 seconds ago),
File "src\<relief>\core\components\libtorrent\download_manager\download_manager.py", line 310, in create_session (function started 18.316 seconds ago)
Here:
def create_session(self, hops=0, store_listen_port=True):
...
# Set listen port & start the DHT
if hops == 0:
ltsession.listen_on(libtorrent_port, libtorrent_port + 10)
if libtorrent_port != ltsession.listen_port() and store_listen_port:
self.config.port = ltsession.listen_port()
try:
with open(self.state_dir / LTSTATE_FILENAME, 'rb') as fp:
lt_state = bdecode_compat(fp.read())
if lt_state is not None:
ltsession.load_state(lt_state) # line 310
...
It looks like load_state can be very slow, we should consider calling it outside of the asyncio event loop.
https://sentry.tribler.org/organizations/tribler/issues/2798/events/491a11cdad524e96956ff63bf12f943a/
Here:
It looks like
load_state
can be very slow, we should consider calling it outside of the asyncio event loop.