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

OpenBSD is unable to recognize zombie process. #2229

Merged
merged 2 commits into from
Apr 12, 2023
Merged

Conversation

giampaolo
Copy link
Owner

Summary

  • OS: OpenBSD
  • Bug fix: yes
  • Type: core

Description

See failure:

====================================================================== ERROR: psutil.tests.test_process.TestProcess.test_zombie_process ---------------------------------------------------------------------- Traceback (most recent call last):
  File "/vagrant/psutil/psutil/_psbsd.py", line 560, in wrapper
    return fun(self, *args, **kwargs)
  File "/vagrant/psutil/psutil/_psbsd.py", line 862, in open_files
    rawlist = cext.proc_open_files(self.pid)
ProcessLookupError: [Errno 3] No such process

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/vagrant/psutil/psutil/tests/test_process.py", line 1312, in test_zombie_process
    zproc.as_dict()
  File "/vagrant/psutil/psutil/__init__.py", line 528, in as_dict
    ret = meth()
  File "/vagrant/psutil/psutil/__init__.py", line 1142, in open_files
    return self._proc.open_files()
  File "/vagrant/psutil/psutil/_psbsd.py", line 565, in wrapper
    raise NoSuchProcess(self.pid, self._name)
psutil.NoSuchProcess: process no longer exists (pid=67013)

This happens because OpenBSD is the only BSD defining 2 codes for zombie processes:

        # According to /usr/include/sys/proc.h SZOMB is unused.
        # test_zombie_process() shows that SDEAD is the right
        # equivalent. Also it appears there's no equivalent of
        # psutil.STATUS_DEAD. SDEAD really means STATUS_ZOMBIE.
        # cext.SZOMB: _common.STATUS_ZOMBIE,
        cext.SDEAD: _common.STATUS_ZOMBIE,
        cext.SZOMB: _common.STATUS_ZOMBIE,

See failure:

======================================================================
ERROR: psutil.tests.test_process.TestProcess.test_zombie_process
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/vagrant/psutil/psutil/_psbsd.py", line 560, in wrapper
    return fun(self, *args, **kwargs)
  File "/vagrant/psutil/psutil/_psbsd.py", line 862, in open_files
    rawlist = cext.proc_open_files(self.pid)
ProcessLookupError: [Errno 3] No such process

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/vagrant/psutil/psutil/tests/test_process.py", line 1312, in test_zombie_process
    zproc.as_dict()
  File "/vagrant/psutil/psutil/__init__.py", line 528, in as_dict
    ret = meth()
  File "/vagrant/psutil/psutil/__init__.py", line 1142, in open_files
    return self._proc.open_files()
  File "/vagrant/psutil/psutil/_psbsd.py", line 565, in wrapper
    raise NoSuchProcess(self.pid, self._name)
psutil.NoSuchProcess: process no longer exists (pid=67013)

----------------------------------------------------------------------
Ran 1 test in 0.136s

FAILED (errors=1)
@giampaolo giampaolo merged commit e6b1659 into master Apr 12, 2023
@giampaolo giampaolo deleted the openbsd-zombie-proc branch April 12, 2023 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant