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

Race condition in ProcessChecker.remove_lock_file() #6775

Closed
kozlovsky opened this issue Feb 21, 2022 · 1 comment · Fixed by #6776
Closed

Race condition in ProcessChecker.remove_lock_file() #6775

kozlovsky opened this issue Feb 21, 2022 · 1 comment · Fixed by #6776
Assignees
Milestone

Comments

@kozlovsky
Copy link
Contributor

When starting Tribler core, FileNotFoundError happened in ProcessChecker.remove_lock_file:

FileNotFoundError: [WinError 2]: 'C:\\Users\\<user>\\AppData\\Roaming\\.Tribler\\triblerd.lock'
  File "run_tribler.py", line 69, in <module>
  File "tribler_core\start_core.py", line 135, in start_tribler_core
  File "tribler_common\process_checker.py", line 26, in __init__
  File "tribler_common\process_checker.py", line 61, in remove_lock_file
  File "pathlib.py", line 1321, in unlink

It seems the previous core process was finishing execution and removed lock file right after lock_file_path.exists() checked that the file is present:

    def remove_lock_file(self):
        """
        Remove the lock file if it exists.
        """
        if self.lock_file_path.exists():
            self.lock_file_path.unlink()  # <- here 

The missing_ok=True option can be added to the unlink call to prevent it.

@kozlovsky kozlovsky self-assigned this Feb 21, 2022
@kozlovsky kozlovsky added this to the 7.12.0 January milestone Feb 21, 2022
@sentry-for-tribler
Copy link

Sentry issue: TRIBLER-D0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

1 participant