nikademus79 / psutil

Automatically exported from code.google.com/p/psutil
Other
0 stars 0 forks source link

FAIL: test_get_pid_list (__main__.TestModuleFunctionsLeaks) #156

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,
on a Debian sid chroot (amd64), when running unit test on the on-built package 
I got:

FAIL: test_get_pid_list (__main__.TestModuleFunctionsLeaks)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_memory_leaks.py", line 155, in test_get_pid_list
    self.execute('get_pid_list')
  File "test/test_memory_leaks.py", line 152, in execute
    self.fail("rss1=%s, rss2=%s, difference=%s" %(rss1, rss2, difference))
AssertionError: rss1=9482240, rss2=9494528, difference=12288

If I can help you somehow in debugging this problem, just ask :)

Original issue reported on code.google.com by matrixhasu on 4 Apr 2011 at 5:57

GoogleCodeExporter commented 8 years ago
Ok, now I see a lot more of failures, all of them (and the original one) on 
python2.6:

======================================================================
ERROR: test_nice (__main__.TestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_psutil.py", line 684, in test_nice
    p.nice = first_nice
  File "/tmp/buildd/python-psutil-0.2.1/build/lib.linux-x86_64-2.6/psutil/__init__.py", line 199, in nice
    return self._platform_impl.set_process_nice(value)
  File "/tmp/buildd/python-psutil-0.2.1/build/lib.linux-x86_64-2.6/psutil/_pslinux.py", line 195, in wrapper
    raise AccessDenied(self.pid, self._process_name)
AccessDenied: (pid=28439)

======================================================================
ERROR: test_test (__main__.TestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_psutil.py", line 1029, in test_test
    psutil.test()
  File "/tmp/buildd/python-psutil-0.2.1/build/lib.linux-x86_64-2.6/psutil/__init__.py", line 653, in test
    line = get_process_info(pid)
  File "/tmp/buildd/python-psutil-0.2.1/build/lib.linux-x86_64-2.6/psutil/__init__.py", line 623, in get_process_info
    user = proc.username
  File "/tmp/buildd/python-psutil-0.2.1/build/lib.linux-x86_64-2.6/psutil/__init__.py", line 244, in username
    return pwd.getpwuid(self.uids.real).pw_name
KeyError: 'getpwuid(): uid not found: 107'

======================================================================
ERROR: test_process_cmdline (_posix.PosixSpecificTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/buildd/python-psutil-0.2.1/test/_posix.py", line 114, in test_process_cmdline
    psutil_cmdline = " ".join(psutil.Process(self.pid).cmdline)
  File "/tmp/buildd/python-psutil-0.2.1/build/lib.linux-x86_64-2.6/psutil/__init__.py", line 80, in __init__
    raise NoSuchProcess(pid, None, "no process found with PID %s" % pid)
NoSuchProcess: no process found with PID 28478

======================================================================
ERROR: test_process_exe (_posix.PosixSpecificTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/buildd/python-psutil-0.2.1/test/_posix.py", line 98, in test_process_exe
    psutil_pathname = psutil.Process(self.pid).exe
  File "/tmp/buildd/python-psutil-0.2.1/build/lib.linux-x86_64-2.6/psutil/__init__.py", line 80, in __init__
    raise NoSuchProcess(pid, None, "no process found with PID %s" % pid)
NoSuchProcess: no process found with PID 28481

======================================================================
ERROR: test_process_gid (_posix.PosixSpecificTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/buildd/python-psutil-0.2.1/test/_posix.py", line 59, in test_process_gid
    gid_psutil = psutil.Process(self.pid).gids.real
  File "/tmp/buildd/python-psutil-0.2.1/build/lib.linux-x86_64-2.6/psutil/__init__.py", line 80, in __init__
    raise NoSuchProcess(pid, None, "no process found with PID %s" % pid)
NoSuchProcess: no process found with PID 28484

======================================================================
ERROR: test_process_name (_posix.PosixSpecificTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/buildd/python-psutil-0.2.1/test/_posix.py", line 90, in test_process_name
    name_psutil = psutil.Process(self.pid).name
  File "/tmp/buildd/python-psutil-0.2.1/build/lib.linux-x86_64-2.6/psutil/__init__.py", line 80, in __init__
    raise NoSuchProcess(pid, None, "no process found with PID %s" % pid)
NoSuchProcess: no process found with PID 28487

======================================================================
ERROR: test_process_parent_pid (_posix.PosixSpecificTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/buildd/python-psutil-0.2.1/test/_posix.py", line 49, in test_process_parent_pid
    ppid_psutil = psutil.Process(self.pid).ppid
  File "/tmp/buildd/python-psutil-0.2.1/build/lib.linux-x86_64-2.6/psutil/__init__.py", line 80, in __init__
    raise NoSuchProcess(pid, None, "no process found with PID %s" % pid)
NoSuchProcess: no process found with PID 28490

======================================================================
ERROR: test_process_uid (_posix.PosixSpecificTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/buildd/python-psutil-0.2.1/test/_posix.py", line 54, in test_process_uid
    uid_psutil = psutil.Process(self.pid).uids.real
  File "/tmp/buildd/python-psutil-0.2.1/build/lib.linux-x86_64-2.6/psutil/__init__.py", line 80, in __init__
    raise NoSuchProcess(pid, None, "no process found with PID %s" % pid)
NoSuchProcess: no process found with PID 28494

======================================================================
ERROR: test_process_username (_posix.PosixSpecificTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/buildd/python-psutil-0.2.1/test/_posix.py", line 64, in test_process_username
    username_psutil = psutil.Process(self.pid).username
  File "/tmp/buildd/python-psutil-0.2.1/build/lib.linux-x86_64-2.6/psutil/__init__.py", line 80, in __init__
    raise NoSuchProcess(pid, None, "no process found with PID %s" % pid)
NoSuchProcess: no process found with PID 28497

======================================================================
FAIL: test_cmdline (__main__.TestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_psutil.py", line 634, in test_cmdline
    self.assertEqual(psutil.Process(sproc.pid).cmdline, [PYTHON, "-E"])
AssertionError: [] != ['/usr/bin/python2.6', '-E']

======================================================================
FAIL: test_fetch_all (__main__.TestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_psutil.py", line 1155, in test_fetch_all
    %(trace, name, p.pid, repr(ret)))
AssertionError: Traceback (most recent call last):
  File "test/test_psutil.py", line 1132, in test_fetch_all
    attr = getattr(p, name, None)
  File "/tmp/buildd/python-psutil-0.2.1/build/lib.linux-x86_64-2.6/psutil/__init__.py", line 244, in username
    return pwd.getpwuid(self.uids.real).pw_name
KeyError: 'getpwuid(): uid not found: 107'

method=username, pid=1608, retvalue=user(real=107, effective=107, saved=107)

======================================================================
FAIL: test_get_io_counters (__main__.TestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_psutil.py", line 136, in inner
    return fun(self, *args, **kwargs)
  File "test/test_psutil.py", line 464, in test_get_io_counters
    self.assertTrue(io2.write_bytes > io1.write_bytes)
AssertionError

----------------------------------------------------------------------

Original comment by matrixhasu on 4 Apr 2011 at 6:04

GoogleCodeExporter commented 8 years ago
the same errors happen with 2.5 too

Original comment by matrixhasu on 4 Apr 2011 at 6:15

GoogleCodeExporter commented 8 years ago
This slipped under my radar, I'm sorry.
That many failures are weird.
It almost seems like /proc filesystem is not available on that linux box.
Can you confirm /proc exists?
Also, does it change anything if you run tests as root?

Original comment by g.rodola on 4 Jun 2011 at 12:08

GoogleCodeExporter commented 8 years ago
No problem :) I'm going to give a more detailed situation of how I get those 
FAILs:

- my user has uid 1000 (the default for the first used on a Debian system)
- I do the Debian packaging with my user
- I test the package in a clean chroot, using pbuilder (a tool that creates the 
chroot and builds the package in it)
- pbuilder chroot has /proc mounted (bindmounted from the system one)
- pbuilder is executed by my user, but inside the chroot, the user is root.

HTH

Original comment by matrixhasu on 4 Jun 2011 at 1:31

GoogleCodeExporter commented 8 years ago
I noticed most of the failures occur in PosixSpecificTestCase, which gets 
executed *after* LimitedUsedTestCase which change the uid/gid of the current 
process and maybe that's what causes problem.
I changed the execution order in r1024.
Can you tell me if it makes any difference?

I don't know pbuilder nor it's clear to me what kind of chroot environment you 
have there (sorry).
Most of the failures seem related to missing /proc/{PID} directory which is 
quite strange. 
My best guess it that somehow, because of your chroot settings this is not 
mounted/reachable at that path, but it's just a guess.
It's likely you have more chances to debug the problem. 
Just keep in mind that almost anything psutil does on Linux is reading /proc 
directory, hence that's where you have to look when debugging.

Looking forward to hear if r1024 fixed or mitigated the problem.

Original comment by g.rodola on 13 Jun 2011 at 6:06

GoogleCodeExporter commented 8 years ago
Sorry I didn't get back to you earlier. While packaging 0.3.0 (so with r1024 
included) I still got the same error:

======================================================================
ERROR: test_nice (__main__.TestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_psutil.py", line 814, in test_nice
    p.nice = first_nice
  File "/home/morph/deb/build-area/python-psutil-0.3.0/build/lib.linux-x86_64-2.7/psutil/__init__.py", line 210, in nice
    return self._platform_impl.set_process_nice(value)
  File "/home/morph/deb/build-area/python-psutil-0.3.0/build/lib.linux-x86_64-2.7/psutil/_pslinux.py", line 253, in wrapper
    raise AccessDenied(self.pid, self._process_name)
AccessDenied: (pid=28102)

======================================================================

In this chroot, the /proc fs is bind-mounted from the system one, so it can 
actually see even the info for process outside the chroot.

Original comment by matrixhasu on 3 Aug 2011 at 3:07

GoogleCodeExporter commented 8 years ago
I'g going to try to revamp this old issue.
Do you still have access to that Linux box?
If not I'm going to close this out.

Original comment by g.rodola on 13 Dec 2012 at 2:44

GoogleCodeExporter commented 8 years ago
They are almost all fixed, except for this one, on py3.2:

======================================================================
FAIL: test_vmem_free (_linux.LinuxSpecificTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/morph/deb/build-area/python-psutil-0.6.1/test/_linux.py", line 91, in test_vmem_free
    self.assert_eq_w_tol(free, psutil.virtual_memory().free, TOLERANCE)
  File "/home/morph/deb/build-area/python-psutil-0.6.1/test/_linux.py", line 34, in assert_eq_w_tol
    raise AssertionError(msg)
AssertionError: 188915712 != 189169664 within 204800 delta (253952 difference)

and also

======================================================================
FAIL: test_swap_memory (__main__.TestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_psutil.py", line 394, in test_swap_memory
    assert mem.total > 0, mem
AssertionError: swap(total=0L, used=0L, free=0L, percent=0.0, sin=0, sout=0)

which I was sure I had already reported but I can't find it at hand (here the 
trick is to check for mem.total >= 0 since I don't have swap on this machine); 
ah here it is: http://code.google.com/p/psutil/issues/detail?id=57

Original comment by sandro.tosi on 1 Jan 2013 at 10:34

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Updated csets after the SVN -> Mercurial migration:
r1024 == revision 325efde3060b

Original comment by g.rodola on 2 Mar 2013 at 11:59