-
-
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
OS X Process.memory_maps() can crash a process #514
Comments
does what you're experiencing cause just the target process to crash? or the host itself to crash? i'm experiencing a similar issue (python 2.7) but in random cases it causes the host itself to crash.. (10.8 and 10.9) i have a feeling we're having similar but different issues; wanting to verify... |
It's almost impossible to reproduce in a deterministic manner. I loop through all processes calling get_memory_maps and eventually stuff starts crashing. Sometimes it'll get the Dock, Finder, or even the login process causing me to get logged out. |
yea; but does the host ever crash? (ie: reboot?) |
I've never seen it reboot, only testing with python3 and 10.9. |
k; then either i'm seeing slightly diff behavior with py2.7 or a diff bug; gonna spend some time trying to re-produce... thx for the insight =) |
I've done some additional testing and I've come to the conclusion that it is not get_memory_maps but instead get_threads. I'm still testing to see if other attributes will cause failure. If you crash launchd (OS X's version of init), the kernel will panic causing an auto reboot which @wesyoung may have seen. |
…514: [OSX] Process.memory_maps() segfault (critical!).D
I know this is a long standing issue but I think I may have found the cause of this. We forgot to check the return value of |
|
OS: OS X 10.9.3
Python: 3.4.0
psutil: 2.1.1
Code: psutil.Process(target_pid).get_memory_maps()
I'm not quite sure why the code causes the target process to crash, it's rare on my laptop, impossible on a VM, but occurs often on other laptops.
Crash logs always indicate:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x.....
From what I can tell, the culprit is https://github.com/giampaolo/psutil/blob/master/psutil/_psutil_osx.c#L408
The next virtual memory region isn't necessarily a size offset from the current. The start of the next memory address can be page aligned.
The text was updated successfully, but these errors were encountered: