Skip to content

Linux: Spurious psutil.NoSuchProcess exceptions in get_process_id_by_process_name #21

@tgiddings

Description

@tgiddings

If a process (not the process the user is looking for) dies while get_process_id_by_process_name is iterating, the .name() call will raise psutil.NoSuchProcess, even though the process being searched for may exist. I encountered this using an app which calls OpenProcess(process_name=...) every 100ms to check if a process is alive. On my machine (KDE-based, which often has "kworker" processes coming and going), the app mistakenly detects process death after approximately 5 minutes, which is approximately 3,000 uses of OpenProcess(process_name=...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions