Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit if process is a zombie process #7

Merged
merged 1 commit into from
Jan 24, 2014
Merged

Conversation

astrofrog
Copy link
Owner

@embray - could you try this branch?

@embray
Copy link

embray commented Jan 23, 2014

I just tried almost exactly that, and that should do it I think. It's still just odd that it's needed, since the psutil docs say NoSuchProcess is raised when the process is in zombie state, but maybe not all its methods actually do that...

@embray
Copy link

embray commented Jan 23, 2014

I see the problem in psutil. The way it implements Process.get_cpu_times and Process.get_memory_info on Linux are to read them right out of /proc/<pid>/stat[m] which will work just fine for zombie processes--it doesn't check the process status before returning results from those calls so it never has an opportunity to raise NoSuchProcess. I'll send them a patch :)

This also explains why you've never seen it, as it's a Linux-specific issue.

@astrofrog
Copy link
Owner Author

@embray - ah I see, thanks for looking into it! In the mean time, does this PR provide a workaround?

@embray
Copy link

embray commented Jan 23, 2014

Yes, this workaround is fine for now. See also https://code.google.com/p/psutil/issues/detail?id=467

astrofrog added a commit that referenced this pull request Jan 24, 2014
Exit if process is a zombie process
@astrofrog astrofrog merged commit 519f3d7 into master Jan 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants