Handle ZombieProcess
and NoSuchProcess
from psutil
for OSX systems
#1599
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…://github.com//issues/1588
What I did
I added a check to ensure that a process in is actually an active process. There are many circumstances in OSX where one can have hanging/zombie processes. In this instance, the process name does not exist as the process has been terminated. This causes a really confusing
psutil
error for the userRelated issue: #1588
How I did it
As with many bugs, this fix is quite simple when the origin of the bug has been pinned down. The following code
brownie/brownie/network/rpc/__init__.py
Lines 253 to 256 in 4ae5f52
will fail for certain
psutil
cases (yieldingZombieProcess
andNoSuchProcess
shown below for ease of viewing and linked)Added a try/except loop to catch the specific error and skip it.
This is the most intuitive way of catching this error as there is no way to filter the list of iterated processes to improve efficiency.
How to verify it
This is really tough - you need to somehow create a hanging process. It should be obvious from the code within
psutil
https://github.com/giampaolo/psutil/blob/4446e3bd5fd29e0598f2ca6672d5ffe8ca40d442/psutil/_psosx.py#L336-L353
It will be difficult to create zombie processes or hanging processes for a full regression test. I don't think there should be test cases for such an obscure issue as a result. Satisfying the existing tests should be sufficient.
simple verification using existing bad system setup
as shown by ..
The fix avoids this problem ...
For now it can be manually corrected by removing the bad processes like
Checklist