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=...)
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 raisepsutil.NoSuchProcess, even though the process being searched for may exist. I encountered this using an app which callsOpenProcess(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 ofOpenProcess(process_name=...)