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

[7.12.1] AccessDenied in set_process_priority #7408

Closed
kozlovsky opened this issue May 8, 2023 · 1 comment · Fixed by #7594
Closed

[7.12.1] AccessDenied in set_process_priority #7408

kozlovsky opened this issue May 8, 2023 · 1 comment · Fixed by #7594
Assignees

Comments

@kozlovsky
Copy link
Contributor

Here:

def set_process_priority(pid=None, priority_order=1):
    ...
    process = psutil.Process(pid if pid else os.getpid())

    if sys.platform == 'win32':
        ...
    elif sys.platform == 'darwin' or sys.platform == 'linux2':
        # On Unix, priority can be -20 to 20, but usually not allowed to set below 0, we set our classes somewhat in
        # that range.
        priority_classes = [5, 4, 3, 2, 1, 0]
        process.nice(priority_classes[priority_order])  # <-- here
run_tribler.py in <module> at line 94
tribler/core/start_core.py in run_core at line 185
tribler/core/start_core.py in run_tribler_core_session at line 148
tribler/core/check_os.py in set_process_priority at line 84
__init__.py in nice at line 724

It looks like we should wrap the process.nice call with try/except block, catch the psutil.AccessDenied exception, and log it (probably put try/except at the top level of the function to catch possible Windows errors as well).

@sentry-for-tribler
Copy link

Sentry issue: TRIBLER-16J

@drew2a drew2a self-assigned this Sep 7, 2023
@drew2a drew2a added this to the 7.14.0 milestone Sep 7, 2023
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.

2 participants