Skip to content

Process.is_running() doesn't actually check whether PID has been reused #286

Closed
@giampaolo

Description

From g.rodola on June 19, 2012 20:16:08

The doc states:

> Return whether the current process is running in 
> the current process list. This is reliable also in 
> case the process is gone and its PID reused, 
> therefore it must be preferred over doing 
> psutil.pid_exists(p.pid).

After a look at how this is done I realized that the logic we're using to 
ensure the PID has not been reused is broken. 
https://code.google.com/p/psutil/source/browse/tags/release-0.4.1/psutil/__init__.py#412
 What we're doing here is just requesting the creation time for the same PID 
(not sure why I made such a naive mistake and never realized it thus far). 
Instead, process creation time should be stored when the class is instantiated.

Original issue: http://code.google.com/p/psutil/issues/detail?id=286

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions