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
IOError: [Errno 14 (EFAULT)] Bad address raised from psutil.Process() #905
Comments
Mmmm that's bad. No, that's not an error you're supposed to catch. I have no idea why it happens and I couldn't find anything on Google, so it may as well be a kernel bug AFAIK. At first I suspected this was a race condition, meaning the PID/process is gone in between open() and read() calls. So I made this quick test script:
....but it raise
Once you're in the pdb you can do |
I don't think this can be the issue, since in the case where I'm seeing this, the process whose stat file I'm failing to read is the process in which the exception is being raised. I forgot to mention this above, but another confounding variable here is that I'm doing this in a docker container, which means my pid namespace is being virtualized. My current best guess is that that's somehow the culprit, but I haven't been able to figure out a clear pattern yet. |
Mmm...
If it's a temporary condition we might try to retry in case of EFAULT. |
Any news about this? It would be great if this could be investigated. |
@giampaolo sorry, I lost track of this thread. I haven't seen the issue here in a bit. I'll try to investigate if/when I see it next. I might be able to at least get better logging around whether retrying is helpful. The |
I'm running an application that periodically tracks the memory usage of its child processes using
psutil.Process
. Occasionally, I see stack traces on instantiation ofProcess
indicating that anEFAULT
was triggered when reading/proc/pid/stat
:Running with psutil version 4.3.0, I get the following traceback on invocation of
psutil.Process()
:The line number at the bottom of the trace corresponds to the
read
call in this block:I'm not sure if this is a kernel bug, if this is an error that psutil should be catching and handling, or if it's an error that I should be catching and handling in my application.
If it's helpful, I'm running Ubuntu 16.04, with kernel version 4.4.0-36:
Thanks for maintaining
psutil
. It's super helpful for us!The text was updated successfully, but these errors were encountered: