Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OpenBSD] Process
num_fds()
and open_files()
may raise NSP for PI…
…D 0 (#2460) This is weird, because of all the sudden the tests below started failing. This is despite PID 0 exists. The syscall failing with `ESRCH` is `kinfo_getfile`: https://github.com/giampaolo/psutil/blob/f8b929b0754a4abbdadfdcb8aae382ddee8a13f9/psutil/arch/openbsd/proc.c#L57 We therefore return "null" fallback values instead of raising `NoSuchProcess`. ``` =================================== FAILURES =================================== ___________________________ TestProcess.test_as_dict ___________________________ psutil/_psbsd.py:604: in wrapper return fun(self, *args, **kwargs) psutil/_psbsd.py:914: in open_files rawlist = cext.proc_open_files(self.pid) E ProcessLookupError: [Errno 3] No such process (originated from sysctl(kinfo_file) (1/2)) During handling of the above exception, another exception occurred: psutil/tests/test_process.py:1309: in test_as_dict d = p.as_dict() psutil/__init__.py:558: in as_dict ret = meth() psutil/__init__.py:1199: in open_files return self._proc.open_files() psutil/_psbsd.py:609: in wrapper raise NoSuchProcess(self.pid, self._name) E psutil.NoSuchProcess: process no longer exists (pid=0) ____________________________ TestProcess.test_pid_0 ____________________________ psutil/_psbsd.py:604: in wrapper return fun(self, *args, **kwargs) psutil/_psbsd.py:914: in open_files rawlist = cext.proc_open_files(self.pid) E ProcessLookupError: [Errno 3] No such process (originated from sysctl(kinfo_file) (1/2)) During handling of the above exception, another exception occurred: psutil/tests/test_process.py:1513: in test_pid_0 ret = fun() psutil/__init__.py:1199: in open_files return self._proc.open_files() psutil/_psbsd.py:609: in wrapper raise NoSuchProcess(self.pid, self._name) E psutil.NoSuchProcess: process no longer exists (pid=0) ________________________ TestFetchAllProcesses.test_all ________________________ psutil/_psbsd.py:604: in wrapper return fun(self, *args, **kwargs) psutil/_psbsd.py:914: in open_files rawlist = cext.proc_open_files(self.pid) E ProcessLookupError: [Errno 3] No such process (originated from sysctl(kinfo_file) (1/2)) During handling of the above exception, another exception occurred: psutil/tests/test_process_all.py:93: in proc_info info[fun_name] = fun() psutil/__init__.py:1199: in open_files return self._proc.open_files() psutil/_psbsd.py:609: in wrapper raise NoSuchProcess(self.pid, self._name) E psutil.NoSuchProcess: process no longer exists (pid=0, name='swapper') During handling of the above exception, another exception occurred: psutil/tests/test_process_all.py:135: in test_all for info in self.iter_proc_info(): psutil/tests/test_process_all.py:130: in iter_proc_info ls.append(proc_info(pid)) psutil/tests/test_process_all.py:95: in proc_info check_exception(exc, proc, name, ppid) psutil/tests/test_process_all.py:65: in check_exception tcase.assertProcessGone(proc) psutil/tests/__init__.py:1069: in assertProcessGone self.assertPidGone(proc.pid) psutil/tests/__init__.py:1057: in assertPidGone with pytest.raises(psutil.NoSuchProcess) as cm: E Failed: DID NOT RAISE <class 'psutil.NoSuchProcess'> ```
- Loading branch information