-
-
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
Process.status() returns 'running' for a ZombieProcess #783
Comments
Mmmm if that is true it's the kernel which is returning the bad info. psutil/psutil/tests/test_process.py Line 1287 in 5c772a1
....which explicitly tests the case assert p.status() == ZOMBIE :psutil/psutil/tests/test_process.py Line 1325 in 5c772a1
Can you run tests ( make test ) and see if that fails?
|
Bump? |
Many tests currently fail immediately OS X 10.11 El Capitain. I'd recommend adding a Travis CI target for OSX.
|
There's already a Travis CI although I'm not sure what OSX version is running. |
Unfortunately, the issue is valid.
|
This was Python 2 I suppose? Can you try Python 3? I wonder whether those apparently unicode related issues are 2.X only. |
Nope, the test failures are still present during
|
Hello Giampaolo, I am actually getting this error/issue with psutil 4.2.0 on Mac OS X 10.11 and running Python 2.7.10 which is the default for OS X 10.11. I have not had a chance to look at this closer but I will try to soon. |
Hello. I should have fixed the zombie issue ( |
Why not add a test and have it checked via macOS continuous integration / Travis? |
That would definitively be cool but I couldn't be able to reproduce the issue thus far. I just corrected what was clearly wrong with pid_exists() |
Actually I realize I stated earlier in this thread that there's a test for this: psutil/psutil/tests/test_process.py Line 1287 in 5c772a1
....which explicitly tests the case assert p.status() == ZOMBIE: psutil/psutil/tests/test_process.py Line 1325 in 5c772a1
Now that I look at the original OP's description more accurately I think that #908 won't fix this specific issue though (
|
Point is on OSX 10.5 (where I'm at) it does return the right value. |
As in OSX 10.5 that was released ten years ago? Like Ubuntu 7.04? |
Exactly :(. I develop on Linux and virtualize OSX on VirtualBox by using an hacked OSX version called iDeneb. |
If Apple provided up to date OS images which developers could use in Azure or AWS (like Microsoft does!), maybe this wouldn't be such an issue. Most developers are not going to bother paying $1000s of bucks to verify if the free & gratis code they are shipping (at no cost) works on a platform they don't use. This is entirely Apple's failing. |
Travis CI offers Mac OS X environments at no cost. The |
OK, I got access to an OSX 10.10.4 Darwin and applied a lots of improvements to the C code. |
Can do tomorrow, thanks Giampaolo! <3
|
FWIW - at commit bdcde7e with OSX El Capitan, I get a test failure for
I get a few other test failures on el capitan as well, but less than I think I was getting in prior builds - here are all failures. This is with python 2.7, after doing make install and manually running tests.
|
OK, this looks better. My interpretation of the test output is that for some reason zombie PIDs do not show up in As for the other failures:
|
I forgot that I am no longer running el cap, but am now on sierra, though my build machines are el capitan so I should be able to verify both. My theory is that the unicode test failures have something to do with the way /private/tmp directories are handled on el capitan/sierra (system integrity protection?), and I think the tests themselves are otherwise fine, but I can't imagine what the actual interaction is. That's a wild theory, and I've been too lazy to reboot into safe mode and disable system integrity protection. I'm happy to help verify tests. |
OK, I have fixed a tons of stuff on OSX. The only failing test which I get on el captain right now is the one related to |
I get this after a pull from master (now commit b184c48) and a tox run:
So these are now passing (yay!) But I am still getting some failures. I am wondering if - and i don't know how this could be - it's not testing the current build somehow. But I've tried to block against that as much as possible. |
OK that looks so much better! I believe all of these failures are related to tests, and do not indicate something wrong with psutil. I'm just not sure how to fix them as I can't reproduce them on my laptop. |
I am keen to consider this one fixed. @the-gigi can you please confirm either by running the test suite or by verifying manually? |
I'm sorry. I don't have access to a Mac anymore. I'm Windows + Linux only these days. |
OK, I'm gonna consider this fixed. We have a test for it which is passing (also on Travis). |
Thanks for following up. I'm sorry I couldn't help verify.
Best, Gigi
…On Mon, Jan 9, 2017 at 11:43 AM, giampaolo ***@***.***> wrote:
Closed #783 <#783>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#783 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABWCNh9I6IBtJ8tk9MBH1mUwqZI9R6O1ks5rQo31gaJpZM4Hk5kN>
.
|
I am facing the same issue here. For a exited Zombie process the status is still running on MacOSX EL Capitan >>> psutil.__version__
'5.3.1'
>>> proc.is_running()
True
>>> proc.memory_info()
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_exec2.py", line 3, in Exec
exec(exp, global_vars, local_vars)
File "<input>", line 1, in <module>
File "/Users/tarun.lalwani/.virtualenvs/project/lib/python3.6/site-packages/psutil/_common.py", line 336, in wrapper
return fun(self)
File "/Users/tarun.lalwani/.virtualenvs/project/lib/python3.6/site-packages/psutil/__init__.py", line 1119, in memory_info
return self._proc.memory_info()
File "/Users/tarun.lalwani/.virtualenvs/project/lib/python3.6/site-packages/psutil/_psosx.py", line 295, in wrapper
return fun(self, *args, **kwargs)
File "/Users/tarun.lalwani/.virtualenvs/project/lib/python3.6/site-packages/psutil/_psosx.py", line 421, in memory_info
rawtuple = self._get_pidtaskinfo()
File "/Users/tarun.lalwani/.virtualenvs/project/lib/python3.6/site-packages/psutil/_common.py", line 336, in wrapper
return fun(self)
File "/Users/tarun.lalwani/.virtualenvs/project/lib/python3.6/site-packages/psutil/_psosx.py", line 352, in _get_pidtaskinfo
ret = cext.proc_pidtaskinfo_oneshot(self.pid)
File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/contextlib.py", line 100, in __exit__
self.gen.throw(type, value, traceback)
File "/Users/tarun.lalwani/.virtualenvs/project/lib/python3.6/site-packages/psutil/_psosx.py", line 324, in catch_zombie
raise ZombieProcess(proc.pid, proc._name, proc._ppid)
psutil.ZombieProcess: psutil.ZombieProcess process still exists but it's a zombie (pid=3555, name='firefox-bin') |
What you see is correct. What does |
that says |
* master: (375 commits) update psutil fix procsmem script which was not printing processes try to fix tests on travis try to fix tests on travis OSX: fix compilation warning giampaolo#936: give credits to Max Bélanger giampaolo#811: move DLL check logic in _pswindows.py winmake: use the right win slashes winmake: do not try to install GIT commit hook if this is not a GIT cloned dir giampaolo#811: on Win XP let the possibility to install psutil from sources as it still (kind of) works) giampaolo#811: add a Q&A section in the doc; tell what Win versions are supported giampaolo#811: raise a meaningful error message if on Windows XP update doc; bump up version giampaolo#939: update MANIFEST to include only src files and not much else update HISTORY travis: execute mem leaks and flake8 tests only on py 2.7 and 3.5; no need to test all python versions bump up version update version in doc add simple test case for oneshot() ctx manager add simple test case for oneshot() ctx manager speedup fetch all process test by using oneshot giampaolo#799 - oneshot / linux: speedup memory_full_info and memory_maps fix flake8 first pass giampaolo#943: better error message in case of version conflict on import. update doc 799 onshot / win: no longer store the handle in python; I am now sure this is slower than using OpenProcess/CloseHandle in C update doc (win) add memleak test for proc_info() move stuff around memleak: fix false positive on windows giampaolo#933 (win) fix memory leak in WindowsService.description() giampaolo#933 (win) fix memory leak in cpu_stats() (missing free()) refactoring giampaolo#799 / win: pass handle also to memory_maps() and username() functions fix numbers mem leak script: provide better error output in case of failure refactor memleak script refactor memleak script refactor memleak script refactor memleak script refactor memleak script: get rid of no longer used logic to deal with Process properties memleak script refactoring doc styling giampaolo#799 / win: use oneshot() around num_threads() and num_ctx_switches(); speedup from 1.2x to 1.8x refactor windows tests win: enable dueal process impl tests win / C: refactor memory_info_2 code() and return it along side other proc_info() metrics windows c refactor proc_info() code update windmake script winmake clean: make it an order of magnitude faster; also update Makefile update doc bench script: add psutil ver winmake: more aggressive logic to uninstall psutil adjust bench2 script to new perf API try to adjust perf upgrade perf code memory leak script: humanize memory difference in case of failure style changes fix giampaolo#932 / netbsd: check connections return value and raise exception netbsd / connections: refactoring netbsd / connections: refactoring netbsd / connections: refactoring netbsd / connections: refactoring netbsd / connections: refactoring testing make clean with unittests was a bad idea after all make 'make clean' 4x faster! add test for make clean adjust winmake script fix netbsd/openvsd compilation failure bsd: fix mem leak osx: fix memory leak pre-release refactoring update IDEAS add mtu test for osx and bsd osx: separate IFFLAGS function osx/bsd: separate IFFLAGS function linux: separate IFFLAGS function share C function to retrieve MTU across all UNIXes HISTORY: make anchors more easily referenceable fix giampaolo#927: Popen.__del__ may cause maximum recursion depth error. fix Popen test which is occasionally failing more releases timeline from README to doc ignore failing tests on OSX + TRAVIS update INSTALL instructions update print_announce.py script update HISTORY HISTORY: provide links to issues on the bug tracker update IDEAS giampaolo#910: [OSX / BSD] in case of error, psutil.pids() raised RuntimeError instead of the original OSError exception. fix unicode tests on windows / py3 small test refactoring fix giampaolo#926: [OSX] Process.environ() on Python 3 can crash interpreter if process environ has an invalid unicode string. osx: fix compiler warnings refactor unicode tests fix unicode test giampaolo#783: fix some unicode related test failures on osx test refactoring test refactroring ...
This is on a Mac OSX El Capitan Here is a quick session to demonstrate. Process 70 on my machine right now is indeed a zombie process.
I followed the code to the status() method in _psxosx.py to see why it returns 'running'
The cext.proc_status(self.pid) returns 2, which is the code for 'running'.
The text was updated successfully, but these errors were encountered: