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

FAIL: test_get_pid_list (__main__.TestModuleFunctionsLeaks) #156

Closed
giampaolo opened this issue May 23, 2014 · 11 comments
Closed

FAIL: test_get_pid_list (__main__.TestModuleFunctionsLeaks) #156

giampaolo opened this issue May 23, 2014 · 11 comments

Comments

@giampaolo
Copy link
Owner

From matrixhasu on April 04, 2011 19:57:43

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: http://code.google.com/p/psutil/issues/detail?id=156

@giampaolo
Copy link
Owner Author

From matrixhasu on April 04, 2011 11:04:06

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)

===...

@giampaolo
Copy link
Owner Author

From matrixhasu on April 04, 2011 11:04:06

...===================================================================
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

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

@giampaolo
Copy link
Owner Author

From matrixhasu on April 04, 2011 11:15:57

the same errors happen with 2.5 too

@giampaolo
Copy link
Owner Author

From g.rodola on June 04, 2011 05:08:12

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?

@giampaolo
Copy link
Owner Author

From matrixhasu on June 04, 2011 06:31:18

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

@giampaolo
Copy link
Owner Author

From g.rodola on June 13, 2011 11:06:40

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.

@giampaolo
Copy link
Owner Author

From matrixhasu on August 03, 2011 08:07:49

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.

@giampaolo
Copy link
Owner Author

From g.rodola on December 13, 2012 06:44:27

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.

Status: WaitingForReview
Labels: OpSys-Linux

@giampaolo
Copy link
Owner Author

From sandro.tosi on January 01, 2013 14:34:38

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: https://code.google.com/p/psutil/issues/detail?id=57

@giampaolo
Copy link
Owner Author

From g.rodola on March 02, 2013 03:59:49

Updated csets after the SVN -> Mercurial migration: r1024 == revision 
325efde3060b

@giampaolo
Copy link
Owner Author

Closing this out as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant