-
-
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.create_time() and hash(process) are not immutable on linux #711
Comments
I am not at home right now so I cannot take a look at the code but if you
|
It became a problem for me because I was sending pids between different On Fri, Nov 13, 2015 at 12:20 PM, giampaolo notifications@github.com
|
I understand the problem but that is a critical part of the code which I'm not willing to change for what I consider to be a very rare edge case. I may have agreed in case the problem occurred within the same python process (that is why they came up with |
...also, I'm kinda curious why you're relying on |
My use case is roughly as follows:
Due to the boot process the clock would change between steps 1 and 2, causing the hash comparison in step 3 to fail. It could be argued that the hash check isn't really necessary, I primarily put it in because I don't well understand how pids get recycled (it seems to be handled differently on each platform) and this seemed like an easy check. I've made a workaround to compute the hash using "jiffies since boot" rather than create_time and that has resolved the issue for me. I don't agree with your justifications about why it's ok for a hash to not be constant, but I understand that your time is limited. If you like I could submit a pull request, or if you decide not to fix it perhaps a warning in the documentation is in order? |
You don't explain why the system clock changes. Are you changing it? If so why? And why between steps 1 and 2? Why can't you launch your application(s) after you change the system clock?
Using I'm still skeptical about this also because apparently this can be fixed only on Linux, which seems to be the only platform where "jiffies" are retrievable. All other platform implementations rely on system clock and are subject to system clock updates. |
The system clock changes as a part of the linux boot process, I don't I tried to reproduce the problem on Windows by manually changing the clock On Fri, Dec 4, 2015 at 3:54 PM, giampaolo notifications@github.com wrote:
|
Looking back at this, I still consider this a marginal issue. Closing this out. |
I've run into two related issues using psutil on linux (Ubuntu 14.04.3):
The problem does not appear to be present on Windows, presumably due to the way creation_time is calculated.
To reproduce:
I do not know what the solution to calculating creation_time is, however, the hash could be made immutable by using the "start time in jiffies since system boot" value (value[19] from
psutil/psutil/_pslinux.py
Line 913 in 5df7474
The text was updated successfully, but these errors were encountered: