| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
Signed-off-by: cui fliter <imcusg@gmail.com>
|
| | |
|
| |
|
|
| |
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
|
| |
|
|
| |
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A recent failure observed on OpenBSD led me to an interesting consideration.
```
======================================================================
ERROR: psutil.tests.test_process.TestProcess.test_long_name
----------------------------------------------------------------------
Traceback (most recent call last):
File "/vagrant/psutil/psutil/_psbsd.py", line 566, in wrapper
return fun(self, *args, **kwargs)
File "/vagrant/psutil/psutil/_psbsd.py", line 684, in cmdline
return cext.proc_cmdline(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 751, in test_long_name
self.assertEqual(p.name(), os.path.basename(testfn))
File "/vagrant/psutil/psutil/__init__.py", line 628, in name
cmdline = self.cmdline()
File "/vagrant/psutil/psutil/__init__.py", line 681, in cmdline
return self._proc.cmdline()
File "/vagrant/psutil/psutil/_psbsd.py", line 569, in wrapper
raise ZombieProcess(self.pid, self._name, self._ppid)
psutil.ZombieProcess: PID still exists but it's a zombie (pid=48379)
----------------------------------------------------------------------
```
The exception above occurs sporadically. It originates from `sysctl
(KERN_PROC_ARGV)`:
https://github.com/giampaolo/psutil/blob/0a81fa089fd4b25b4b7ee71ed39213b83f73c052/psutil/arch/openbsd/proc.c#L149
The error per se does not represent a bug in the OpenBSD `cmdline
()` implemention because the process **really** is a zombie at that point
(I'm not sure why it's a zombie - this seems only to occur only on OpenBSD for
this specific test case - but that's not the point).
The interesting thing is that the test calls process `name()` (which succeeds,
despite it's a zombie process), but since the process name is too long it gets
truncated to 15 chars (this is a UNIX thing) so psutil tries to guess the
remaining characters from the process `cmdline()`, which fails:
https://github.com/giampaolo/psutil/blob/0a81fa089fd4b25b4b7ee71ed39213b83f73c052/psutil/__init__.py#L623-L630
The problem to fix here is that, if `name()` succeeds but `cmdline()` fails, we
should not raise `ZombieProcess`: we should simply return the
(truncated) process `name()` instead, because that is better than nothing.
Not on OpenBSD but on all platforms.
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
|
| | |
|
| | |
|
| |
|
|
| |
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
|
| | |
|
| |
|
| |
Signed-off-by: Daniel Widdis <widdis@gmail.com>
|
| |
|
|
| |
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It is possible that 'free -V' will return a version that includes a
postfix such as '-dirty'. For example procps-ng will explicitly add
this when building from git:
https://gitlab.com/procps-ng/procps/-/blob/master/local/git-version-gen#L154
Process the version string to drop these string postfixes from the
version tuple, failing to do so will result in the test failing
File ".../psutil/tests/test_linux.py", line 204, in get_free_version_info
return tuple(map(int, out.split()[-1].split('.')))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '3-dirty'
Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
|
| | |
|
| |
|
| |
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
B028: No explicit stacklevel argument found. The warn method from
the warnings module uses a stacklevel of 1 by default. This will
only show a stack trace for the line on which the warn method is
called. It is therefore recommended to use a stacklevel of 2 or
greater to provide more information to the user.
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
On windows, starting with python 3.7,
virtual environments use a venvlauncher startup process
This does not play well when counting spawned processes or
when relying on the pid of the spawned process to do some checks
e.g. connection check per pid
This commit detects this situation and uses the base python
executable to spawn processes when required.
Signed-off-by: mayeut <mayeut@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Tests are being run with psutil installed in a virtual environment
within cibuildwheel builds.
The scripts folder is not being found in this installation & thus,
those tests are skipped.
This commit allows to pass the path of the scripts folder through
an environment variable & re-enables those tests.
Signed-off-by: mayeut <mayeut@users.noreply.github.com>
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
#2156, #2010
|
| |
|
| |
Signed-off-by: mayeut <mayeut@users.noreply.github.com>
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
|
| |\
| |
| |
| | |
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
|
| | | |
|
| | |
| |
| |
| |
| |
| | |
Do not use unicode string for network interface flags on Python 2
Update network interface flags tests to work on CentOS 6 (CI tests are currently failing)
Signed-off-by: mayeut <mayeut@users.noreply.github.com>
|
| | | |
|
| | |
| |
| |
| | |
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
|
| | | |
|
| | | |
|
| |\ \ |
|
| | | | |
|
| |/ / |
|
| | |
| |
| |
| | |
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
|
| | |
| |
| |
| | |
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`Process.memory_full_info()` (reporting proecss USS/PSS/Swap memory) now reads ``/proc/pid/smaps_rollup`` instead of ``/proc/pids/smaps`` which makes it 5 times faster.
Without patch:
```
~/svn/psutil {linux-smaps-rollup}$ python3 -m timeit -s "import psutil; p = psutil.Process()" "p.memory_full_info()"
500 loops, best of 5: 518 usec per loop
```
With patch (5 times faster):
```
~/svn/psutil {linux-smaps-rollup}$ python3 -m timeit -s "import psutil; p = psutil.Process()" "p.memory_full_info()"
2000 loops, best of 5: 111 usec per loop
```
----
`make test-memleaks` suite, who heavily rely on `Process.memory_full_info()`, also received a nice speedup:
Before patch:
```
$ make test-memleaks
----------------------------------------------------------------------
Ran 99 tests in 1.646s
OK (skipped=9)
SUCCESS
```
After patch:
```
$ make test-memleaks
----------------------------------------------------------------------
Ran 99 tests in 1.195s
OK (skipped=9)
SUCCESS
```
|
| | |
| |
| | |
Signed-off-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
|