Fix core crashed error because of existing running core #7924
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
.