-
Notifications
You must be signed in to change notification settings - Fork 11
linux: ns: get_process_nspid() support old kernels #20
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
Conversation
This happend when the process dies between us opening the sched file and us reading it. Appearently procfs returns ESRCH when trying to read a procfs file of a dead process, and Python converts it to a ProcessLookupError
|
Following your suggestions to use |
Yes. Let's, instead of returning |
Also, make sure we raise NoSuchProcess in all places instead of weird, un-indicative errors
granulate_utils/linux/ns.py
Outdated
|
|
||
| is_the_same_ns = get_process_ns_inode(process, nstype) == get_process_ns_inode(process2, nstype) | ||
|
|
||
| # If one of the processes isn't running, we checked the wrong one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do this check again, if already done in get_process_ns_inode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_process_ns_inode() doesn't make sure this is the same process.
get_process_ns_inode() might return True, but actually, it was for the wrong process.
But now I'm moving this check into get_process_ns_inode() 🙃
Jongy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
Co-authored-by: Yonatan Goldschmidt <yonatan.goldschmidt@granulate.io>
Co-authored-by: Yonatan Goldschmidt <yonatan.goldschmidt@granulate.io>
Make
get_process_nspid()work with old kernelsTested on Ubuntu 14.04
3.13.0-170-generic