end18 / psutil

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

Process' create_time() should raise NoSuchProcess for zombie processes #77

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
>>> p = psutil.Process(1340)
>>> p.kill()
>>> p.create_time
1266881247.0
>>>

What is the expected output? What do you see instead?
I'd expect NoSuchProcess to be raised after the process has been killed.
This is similar to issue 36 and issue 76.

Original issue reported on code.google.com by billiej...@gmail.com on 22 Feb 2010 at 11:31

GoogleCodeExporter commented 9 years ago
Fixed as r513 by having used GetExitCodeProcess().

Original comment by billiej...@gmail.com on 22 Feb 2010 at 11:40

GoogleCodeExporter commented 9 years ago
Despite the Windows C code implementation was actually broken, it turns out the
problem is affecting all platforms because kill() calls is_running(), which 
calls
create_time, so when we invoke "create_time" we are receiving the value which 
was
previously cached because of kill(), the underlying platform code is not called 
and
NoSuchProcess never gets raised.

We just didn't notice this before because there wasn't a test yet.

I fixed this as r516.

Original comment by billiej...@gmail.com on 23 Feb 2010 at 8:41

GoogleCodeExporter commented 9 years ago
A similar problem was affecting OSX C code, now fixed as r524.

Original comment by billiej...@gmail.com on 28 Feb 2010 at 2:56

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Updated csets after the SVN -> Mercurial migration:
r513 == revision 8c07d4573bca
r516 == revision c9f4cc7f1e9d
r524 == revision 2b8a9c94b4d3

Original comment by g.rodola on 2 Mar 2013 at 11:51