-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 createTime calculation for linux lxc guest is incorrect #1562
Comments
…cess createTime bogus value Process createTime collected using gopsutils/process module and uses as startTime of metric sequence. When running inside lxc, function that calculates create time mixes host and guest stats. See shirou/gopsutil#1562 for more details This leads to two issues: 1. Calculated createTime has future value eventually causing scrapper to skip process collection. 2. dp series startTime is set to future in time value, the consequences are unknown. In order to overcome this issue, we will set createTime to system boot time. In case of lxc, container boot time
Sorry, I don't have a time to dig it deep in this weekend, but is this problem related to this issue? If so, this only happened on LXC 2.0.7, but it still exists on 4.0.9? |
The issue is different, both /proc/stats btime and /proc/[pid]/stats represent host time |
…cess createTime bogus value Process createTime collected using gopsutils/process module and uses as startTime of metric sequence. When running inside lxc, function that calculates create time mixes host and guest stats. See shirou/gopsutil#1562 for more details This leads to two issues: 1. Calculated createTime has future value eventually causing scrapper to skip process collection. 2. dp series startTime is set to future in time value, the consequences are unknown. In order to overcome this issue, we will set createTime to system boot time. In case of lxc, container boot time
Let me confirm my understanding. Please point out if I'm wrong.
LXC guest changed to see What we want as the Where "BootTime" is definitely the Host BootTime in the case of host. However, in the case of lxc container guest, what we want is not the Host BootTime(== If my understanding is correct, then I would expect the same thing to happen with Docker containers. |
Not quite: |
Describe the bug
createTime for processes running in lxc utilize in calculation container boot time, based on uptime (gopsutil/internal/common
/common_linux.go:78)
and /proc/[pid]/stats field 22 that represent process start time that based on host boot time (gopsutil/process/process_linux.go:1074)
As a result, when host boot time considerably differ from lxc boot time, createTime of lxc processes has future value.
To Reproduce
Expected behavior
Possible fix, in case of VirtualizationSystem is lxc and VirtualizationRole is guest, use host boot time from /proc/stat in conjunction with
/proc/[pid]/stats field 22 (gopsutil/process/process_linux.go:1074)
Environment:
Ubuntu 20.04.6 LTS
Linux 5.15.30-051530-generic
Lxc 4.0.9
The text was updated successfully, but these errors were encountered: