Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement proper locking of triblerd.lock file #6947

Closed
kozlovsky opened this issue Jun 24, 2022 · 1 comment
Closed

Implement proper locking of triblerd.lock file #6947

kozlovsky opened this issue Jun 24, 2022 · 1 comment

Comments

@kozlovsky
Copy link
Contributor

Right now, despite the name, there is no locking of the triblerd.lock file. The file stores a process ID of the running core instance. Tribler tries to determine if the process was already terminated due to a crash, and the algorithm for this is not 100% reliable. For example, sometimes, the Tribler process that ApplicationTester runs crashes and leaves the triblerd.lock file. After that, ApplicationTester cannot run Tribler, as it assumes that the core is already running and refuses to start with the message 'Core is already running, exiting'. In that case, manual intervention is sometimes necessary to delete the obsolete triblerd.lock file.

It may be better to use an actual file locking, so if it is possible to acquire a lock on the file, it is clear that the previous Tribler process is already terminated.

To implement proper file locking, we can create a small SQLite database and use it as a lock file. Another option is to use a separate library such as filelock. I prefer to use SQLite, as in that case, we rely on the same lock implementation that we already implicitly use in the main database. This way, we can expect fewer surprises on different platforms, and also it allows us in the future to store the detailed journal of Tribler restarts in the same file, which can be helpful to debug some problems.

@kozlovsky kozlovsky added this to the Backlog milestone Jun 24, 2022
@drew2a
Copy link
Contributor

drew2a commented Mar 15, 2023

the triblerd.lock has been removed here #7212

@drew2a drew2a closed this as completed Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants