PFZheng / psutil

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

(Linux) race condition in process files, threads and connections #292

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
These 3 functions have the peculiarity that we read multiple files in /proc to 
extract the information we need.
While doing so we ignore ENOENT (no such file) errors because that means a 
certain file/thread/connection disappeared on us while iterating:

http://code.google.com/p/psutil/source/browse/tags/release-0.5.0/psutil/_pslinux
.py#601
http://code.google.com/p/psutil/source/browse/tags/release-0.5.0/psutil/_pslinux
.py#715
http://code.google.com/p/psutil/source/browse/tags/release-0.5.0/psutil/_pslinux
.py#778

That might also mean, though, that also the *process* disappeared on us, and 
that's not taken into accout.
The risk is that if we hit the race condition we get an empty list as a result, 
meaning the process has no threads/files/connections, while instead we should 
get a NoSuchProcess exception.

Original issue reported on code.google.com by g.rodola on 28 Jun 2012 at 3:23

GoogleCodeExporter commented 8 years ago
Fixed in r1393.

Original comment by g.rodola on 28 Jun 2012 at 3:27

GoogleCodeExporter commented 8 years ago

Original comment by g.rodola on 29 Jun 2012 at 4:48

GoogleCodeExporter commented 8 years ago

Original comment by g.rodola on 29 Jun 2012 at 6:46

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

Original comment by g.rodola on 2 Mar 2013 at 12:09