shanecode / psutil

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

os.readlink can return errno.ESRCH #503

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Traceback:

Traceback (most recent call last):
  File "/usr/local/bin/thermos_observe/twitter/common/exceptions/__init__.py", line 126, in _excepting_run
  File "/usr/local/bin/thermos_observe/twitter/aurora/observer/mesos_vars.py", line 510, in run
  File "/usr/local/bin/thermos_observe/twitter/aurora/observer/mesos_vars.py", line 314, in collect
  File "/usr/local/bin/thermos_observe/twitter/aurora/observer/mesos_vars.py", line 324, in collect_slaves
  File "/root/.pex/install/3c8008ea22662d5ffd7a5f0b056c41fdc13c1c49/psutil-1.1.2-py2.6-linux-x86_64.egg/psutil/_common.py", line 48, in __get__
    ret = self.func(instance)
  File "/root/.pex/install/3c8008ea22662d5ffd7a5f0b056c41fdc13c1c49/psutil-1.1.2-py2.6-linux-x86_64.egg/psutil/__init__.py", line 380, in exe
    exe = self._platform_impl.get_process_exe()
  File "/root/.pex/install/3c8008ea22662d5ffd7a5f0b056c41fdc13c1c49/psutil-1.1.2-py2.6-linux-x86_64.egg/psutil/_pslinux.py", line 480, in get_process_exe
    exe = os.readlink("/proc/%s/exe" % self.pid)
OSError: [Errno 3] No such process: '/proc/563/exe'

What version of psutil are you using? What Python version?
psutil 1.1.2
Python 2.6.8

On what operating system? Is it 32bit or 64bit version?
Linux x86_64 2.6.50 custom kernel

Please provide any additional information below.

Verified that this code is unchanged in 2.1.1.

It looks like os.readlink('/proc/pid/exe') actually raises OSError errno.ESRCH 
instead of errno.ENOENT when it races.

This is fairly rare -- the code runs on many, many machines and we've only 
experienced this issue a handful of times.

Original issue reported on code.google.com by wick...@gmail.com on 8 May 2014 at 2:04

GoogleCodeExporter commented 9 years ago
Thanks. Fixed in revision 1c6aac966b4f.

Original comment by g.rodola on 8 May 2014 at 3:36