-
Notifications
You must be signed in to change notification settings - Fork 172
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
Ignore psutil exceptions in _find_agent. #203
Conversation
Hey Peter. I don't know nearly enough about the architecture of this module to gauge whether it's wise to ignore all psutil errors. Maybe psutil.ZombieProcess or psutil.NoSuchProcess would be a more fitting exception to catch? |
Since the _find_agent function is run at import time, I still think we should ignore all psutil exceptions. |
Bumping this PR. Is there further work that needs to be done for it to be merged? Thanks. |
Yeah we also independently ran into this issue, implemented the same fix, was about to make a PR and then saw this ticket 👍 |
Hi @peter50216! Thank you for the patch, and I'm very sorry for the delays in reviewing it and getting it merged. |
except psutil.Error: | ||
# Exception when getting proc info, possibly because the | ||
# process is zombie / process no longer exist. Just ignore it. | ||
pass |
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.
I think I'd prefer to log when these errors occur, just in case, so that it doesn't silently cause something else to fail in some edge case in the future. I'm happy to make that change myself after merging your patch.
Merged and in version 3.0.1. |
Fix #201.
When there's zombie process in system or some process disappears before listing and getting attributes, methods on
proc
would raisepsutil.Error
, and theimport gnupg
statement would fail.