Tribler / tribler

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

Fix core crashed error because of existing running core #7924

Closed xoriole closed 4 months ago

xoriole commented 4 months ago

Based on the current architecture, the GUI spawns the core process and maintains its lifecycle. However, that is not always the case for some unclear reasons as reported on user sentry reports (links below). Evident from the reports is that there is still a core process running in the background which prevents any successful attempt to run Tribler again unless the core process is somehow terminated. This leads to bad user experience with repeated crash reports.

The purpose of this PR is to change how we handle the cases where there is an existing core process. Instead of crashing on user that there is an existing core process with which the GUI cannot talk to and simply crash. With the changes proposed on this PR, GUI shall try to connect to such existing core process, however, would not (or could not) the lifecycle of the core process.

With the merge of this PR, it will address the following issues. To be specific, the listed issues occur if the core process spawned by the GUI is terminated abruptly (eg. sys.exit(code)). The PR only addresses for the case where the exit code is EXITCODE_ANOTHER_CORE_PROCESS_IS_RUNNING:97.