shanecode / psutil

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

psutil 2.1.0 network connection functions not working on Arch Linux #497

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,

testing the new psutil.net_connections() function resultet in an error. Also 
the update from psutil 2.0.0 to 2.1.0 broke psutil.Process.connections() on my 
machine.

What steps will reproduce the problem?
# python
Python 3.4.0 (default, Mar 17 2014, 23:20:09)
[GCC 4.8.2 20140206 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
>>> psutil.net_connections()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.4/site-packages/psutil/__init__.py", line 1790, in net_connections
    return _psplatform.net_connections(kind)
  File "/usr/lib/python3.4/site-packages/psutil/_pslinux.py", line 572, in net_connections
    return _connections.retrieve(kind)
  File "/usr/lib/python3.4/site-packages/psutil/_pslinux.py", line 556, in retrieve
    for fd, family, type_, laddr, raddr, status, bound_pid in ls:
  File "/usr/lib/python3.4/site-packages/psutil/_pslinux.py", line 490, in process_inet
    raise ValueError("ambiguos inode with multiple "
ValueError: ambiguos inode with multiple PIDs references

What is the expected output?
A list of all existing socket connections.

What do you see instead?
An error (as posted above).

What version of psutil are you using? What Python version?
psutil 2.1.0, python 3.4 and python 2.7.6

On what operating system? Is it 32bit or 64bit version?
Arch Linux, 64bit

Please provide any additional information below.

According to the comment in line 486 - 488 in psutil/_pslinux.py you don't want 
to check for multiple inodes if it is a Unix Socket - but the check for type_ 
!= socket.AF_UNIX in the if-statement seems to be missing.
After patching the file (see attached diff) it seems to work as intended.

Kind regards,

Alexander Grothe

Original issue reported on code.google.com by Alexande...@googlemail.com on 17 Apr 2014 at 11:48

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks, fixed in revision 7ed2ca4ba90b. I will provide a release (reasonably) 
soon.

Original comment by g.rodola on 17 Apr 2014 at 9:08

GoogleCodeExporter commented 9 years ago

Original comment by g.rodola on 13 May 2014 at 2:43