-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[Linux] Properly raise ZombieProcess in exe() method #2062
Conversation
Signed-off-by: Yonatan Goldschmidt <[email protected]>
1fefda0
to
941986b
Compare
I will look into the failing test later today |
I looked into the test. The logic here is incorrect:
if How should I fix the test? The |
Mmm why are you saying so? Can you provide a test case? psutil/psutil/tests/test_process.py Line 1297 in 1da9f79
Also, if there really is a problem with zombie detection, then we probably also have a problem with other Process methods, not only exe() .
With that said, by looking at the Linux code I also suspect we're not detecting/handling zombie properly, because BSD and OSX implementations do something different, similar to what you're doing in this PR:
|
OK, I see what you mean now. |
Precisely :) I'm available to work on the PR if you want any changes to get this merged. |
We're using a patched version to work around this bug:
I'd love to remove it and get back to mainline haha. |
I'm afraid this may affect other methods other than |
As I suspected, it turns out the problem not only affects process |
That's great! Thanks. |
Summary
Description
psutil.Process(pid).exe()
returns""
for zombie processes, incorrectly. It should raiseZombieProcess
, and return""
only for kernel threads.This PR fixes the logic (I wrote something quick, I suppose that the logic can be reordered more nicely maybe).
Now we get:
exe
NoSuchProcess
""
ZombieProcess
.Tested on kernel 5.4.
Also fixed & improved the comment along the way.