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

There seems to be a bug in detecting the zombie process #1271

Open
fanisky opened this issue Aug 3, 2021 · 1 comment
Open

There seems to be a bug in detecting the zombie process #1271

fanisky opened this issue Aug 3, 2021 · 1 comment

Comments

@fanisky
Copy link

fanisky commented Aug 3, 2021

It doesn't happen every time, but it happens every day, causing the main program to exit

Code file:
stateless-manager.py

Occurrence code line:
if psutil.Process(pid).status() != 'zombie':

Code snippet:

    logging.info(f'Clearing zombies')

    for job in jobs:
        non_zombie_work = []
        for pid in job.running_work:
            if psutil.Process(pid).status() != 'zombie':
                non_zombie_work.append(pid)
            else:
                del running_work[pid]
                job.total_running = job.total_running - 1

        job.running_work = non_zombie_work

Debug file:

 Traceback (most recent call last):
  File "C:\Program Files\Python37\lib\site-packages\psutil\_pswindows.py", line 679, in wrapper
    return fun(self, *args, **kwargs)
  File "C:\Program Files\Python37\lib\site-packages\psutil\_pswindows.py", line 1054, in status
    suspended = cext.proc_is_suspended(self.pid)
ProcessLookupError: [Errno 3] assume no such process (originated from NtQuerySystemInformation (no PID found))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\auto-chia\Swar-Chia-Plot-Manager-main\stateless-manager.py", line 99, in <module>
    if psutil.Process(pid).status() != 'zombie':
  File "C:\Program Files\Python37\lib\site-packages\psutil\__init__.py", line 682, in status
    return self._proc.status()
  File "C:\Program Files\Python37\lib\site-packages\psutil\_pswindows.py", line 681, in wrapper
    raise convert_oserror(err, pid=self.pid, name=self._name)
psutil.NoSuchProcess: psutil.NoSuchProcess process no longer exists (pid=12184)
@fanisky
Copy link
Author

fanisky commented Aug 4, 2021

Exception should be caught.
Or first determine whether the process number exists?

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

No branches or pull requests

1 participant