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 fixes #1673

Merged
merged 6 commits into from
Jan 27, 2020
Merged

OpenBSD fixes #1673

merged 6 commits into from
Jan 27, 2020

Conversation

giampaolo
Copy link
Owner

Fixes some Process methods which were broken on OpenBSD when the process is terminated (not getting NSP). Methods are: connections(), num_fds(), threads().
Also FreeBSD pids() implementation was refactored and cleaneup up.

======================================================================
ERROR: psutil.tests.test_misc.TestMisc.test_serialization
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/psutil/psutil/tests/test_misc.py", line 357, in test_serialization
    check(psutil.Process().as_dict())
  File "/root/psutil/psutil/__init__.py", line 538, in as_dict
    ret = meth()
  File "/root/psutil/psutil/__init__.py", line 886, in threads
    return self._proc.threads()
  File "/root/psutil/psutil/_psbsd.py", line 552, in wrapper
    return fun(self, *args, **kwargs)
  File "/root/psutil/psutil/_psbsd.py", line 750, in threads
    rawlist = cext.proc_threads(self.pid)
RuntimeError: kvm_openfiles() syscall failed

======================================================================
ERROR: psutil.tests.test_posix.TestProcess.test_num_fds
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/psutil/psutil/tests/test_posix.py", line 317, in test_num_fds
    call(p, name)
  File "/root/psutil/psutil/tests/test_posix.py", line 297, in call
    attr(*args)
  File "/root/psutil/psutil/__init__.py", line 876, in num_threads
    return self._proc.num_threads()
  File "/root/psutil/psutil/_psbsd.py", line 552, in wrapper
    return fun(self, *args, **kwargs)
  File "/root/psutil/psutil/_psbsd.py", line 738, in num_threads
    return len(self.threads())
  File "/root/psutil/psutil/_psbsd.py", line 552, in wrapper
    return fun(self, *args, **kwargs)
  File "/root/psutil/psutil/_psbsd.py", line 750, in threads
    rawlist = cext.proc_threads(self.pid)
RuntimeError: kvm_openfiles() syscall failed

======================================================================
ERROR: psutil.tests.test_process.TestProcess.test_halfway_terminated_process
----------------------------------------------------------------------
ProcessLookupError: [Errno 3] No such process

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/psutil/psutil/tests/test_process.py", line 1319, in test_halfway_terminated_process
    ret = meth()
  File "/root/psutil/psutil/__init__.py", line 1178, in connections
    return self._proc.connections(kind)
  File "/root/psutil/psutil/_psbsd.py", line 552, in wrapper
    return fun(self, *args, **kwargs)
  File "/root/psutil/psutil/_psbsd.py", line 780, in connections
    rawlist = cext.proc_connections(self.pid, families, types)
SystemError: <class 'OSError'> returned a result with an error set

======================================================================
FAIL: psutil.tests.test_contracts.TestFetchAllProcesses.test_fetch_all
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/psutil/psutil/tests/test_contracts.py", line 417, in test_fetch_all
    self.fail(''.join(failures))
AssertionError:     
    ======================================================================
    FAIL: test_num_threads (proc=psutil.Process(pid=0, name='swapper', started='21:26:30'))
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/root/psutil/psutil/tests/test_contracts.py", line 384, in test_fetch_all
        ret = self.call_meth(p, name)
      File "/root/psutil/psutil/tests/test_contracts.py", line 373, in call_meth
        return attr(*args, **kwargs)
      File "/root/psutil/psutil/__init__.py", line 876, in num_threads
        return self._proc.num_threads()
      File "/root/psutil/psutil/_psbsd.py", line 552, in wrapper
        return fun(self, *args, **kwargs)
      File "/root/psutil/psutil/_psbsd.py", line 738, in num_threads
        return len(self.threads())
      File "/root/psutil/psutil/_psbsd.py", line 552, in wrapper
        return fun(self, *args, **kwargs)
      File "/root/psutil/psutil/_psbsd.py", line 750, in threads
        rawlist = cext.proc_threads(self.pid)
    RuntimeError: kvm_openfiles() syscall failed

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.

1 participant