anfedorov / psutil

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

test_get_connections() failure on OS X 10.8.4 #397

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
    ======================================================================
    FAIL: test_get_connections (proc=psutil.Process(pid=1759, name='VMware Fusion'), ret=[connection(fd=29, family=2, type=1, local_address=('192.168.15.104', 57061), remote_address=('208.91.0.10', 443), status=7), connection(fd=37, family=2, type=1, local_address=('192.168.15.104', 57068), remote_address=('23.0.51.51', 443), status=7)]))
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "test/test_psutil.py", line 1937, in test_fetch_all
        meth(ret)
      File "test/test_psutil.py", line 2091, in get_connections
        s.bind((conn.local_address[0], 0))
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 224, in meth
        return getattr(self._sock,name)(*args)
    error: [Errno 49] Can't assign requested address

Original issue reported on code.google.com by jlo...@gmail.com on 18 Jun 2013 at 12:44

GoogleCodeExporter commented 8 years ago
Probably has to do with this issue. OS X 10.8.4, when I call get_connections() 
I always get:

In [26]: p1.get_connections()
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-26-2368f2c26189> in <module>()
----> 1 p1.get_connections()

/Users/viktor/anaconda/lib/python2.7/site-packages/psutil/__init__.pyc in 
get_connections(self, kind)
    708         all             the sum of all the possible families and protocols
    709         """
--> 710         return self._platform_impl.get_connections(kind)
    711
    712     def is_running(self):

/Users/viktor/anaconda/lib/python2.7/site-packages/psutil/_psosx.pyc in 
wrapper(self, *args, **kwargs)
    145     def wrapper(self, *args, **kwargs):
    146         try:
--> 147             return fun(self, *args, **kwargs)
    148         except OSError:
    149             err = sys.exc_info()[1]

/Users/viktor/anaconda/lib/python2.7/site-packages/psutil/_psosx.pyc in 
get_connections(self, kind)
    275                              % (kind, ', '.join([repr(x) for x in conn_tmap])))
    276         families, types = conn_tmap[kind]
--> 277         rawlist = _psutil_osx.get_process_connections(self.pid, 
families, types)
    278         ret = []
    279         for item in rawlist:

OSError: [Errno 12] Cannot allocate memory

Original comment by alefnula on 9 Aug 2013 at 10:20

GoogleCodeExporter commented 8 years ago
Ah! That's not good. Unfortunately I cannot reproduce that.
Do you think you could try to debug the issue in order to see what function 
call is failing?
In detail you should look at psutil/_psutil_osx.c, get_process_connections() 
function and put printf()s before all the "PyErr_SetFromErrno(PyExc_OSError);" 
occurrences.

Original comment by g.rodola on 26 Aug 2013 at 8:16