Tribler / tribler

Privacy enhanced BitTorrent client with P2P content discovery
https://www.tribler.org
GNU General Public License v3.0
4.78k stars 443 forks source link

RuntimeError: Access violation - no RTTI data! #7886

Closed sentry-for-tribler[bot] closed 2 weeks ago

sentry-for-tribler[bot] commented 7 months ago

Sentry Issue: TRIBLER-1JG

RuntimeError: Access violation - no RTTI data!
  File "asyncio\events.py", line 81, in _run
  File "ipv8\taskmanager.py", line 131, in done_cb
  File "ipv8\taskmanager.py", line 18, in interval_runner
  File "ipv8\util.py", line 35, in call_async
  File "tribler\core\components\libtorrent\download_manager\download_manager.py", line 538, in _task_process_alerts
drew2a commented 5 months ago
    def _task_process_alerts(self):
        for hops, ltsession in list(self.ltsessions.items()):
            if ltsession:
                for alert in ltsession.pop_alerts():  # error has been raised here
                    self.process_alert(alert, hops=hops)

RTTI = Run Time Type Information.

pop_alerts documentation: https://libtorrent.org/reference-Session.html#pop_alerts()

Alerts is the main mechanism for libtorrent to report errors and events. pop_alerts fills in the vector passed to it with 
pointers to new alerts. The [session](https://libtorrent.org/reference-Session.html#session) still owns these alerts and 
they will stay valid until the next time pop_alerts is called. You may not delete the 
[alert](https://libtorrent.org/reference-Alerts.html#alert) objects.

A user has removed a torrent just before the crash:

Request: DELETE http://localhost:50729/downloads/<hash>
Finished: DELETE http://localhost:50729/downloads/<hash>
Request: GET http://localhost:50729/downloads?get_pieces=1
Finished: GET http://localhost:50729/downloads?get_pieces=1
CoreExceptionHandler.unhandled_error_observer(): RuntimeError: Access violation - no RTTI data!

So, I can identify two probable causes of the error:

  1. An alert from a previous pop_alerts call is being modified/accessed during the current call of pop_alerts.
  2. The information about the sessions becomes outdated during the _task_process_alerts since it caches the session list:
    def _task_process_alerts(self):
        for hops, ltsession in list(self.ltsessions.items()):   # <- here
            ...
drew2a commented 5 months ago

I couldn't find a way to properly fix the error besides addressing it through https://github.com/Tribler/tribler/pull/7940, which fixes potentially dangerous situations but is not the root cause of the original issue. Therefore, I'm unassigning myself from it.

github-actions[bot] commented 3 months ago

This issue has not seen activity for 60 days. It is now marked as stale. Please provide additional information or this issue may be closed in the future. We value your contribution and would love to hear more!

qstokkink commented 2 weeks ago

I cannot reproduce this error. If an error is raised in this location, it is only logged without crashing.

ERROR:DownloadManager:Task resulted in error: Access violation - no RTTI data!
Traceback (most recent call last):
  File "ipv8\taskmanager.py", line 153, in done_cb
    future.result()
  File "ipv8\taskmanager.py", line 28, in interval_runner
    await task(*args)
  File "ipv8\util.py", line 53, in call_async
    return func(*args, **kwargs)
  File "tribler\core\libtorrent\download_manager\download_manager.py", line 604, in _task_process_alerts
    raise RuntimeError("Access violation - no RTTI data!")
RuntimeError: Access violation - no RTTI data!

Apparently, this has already been fixed.