Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
ps ux always returns no btime in /proc/stat #125
Comments
|
I can't reproduce this on 4.4 and older kernels, don't have a 4.6 kernel handy. Can you show me the host's and container's /proc/stat contents? |
|
I also cannot reproduce this on Linux x1 4.6.0-10-generic #12-Ubuntu SMP Thu Aug 4 20:52:56 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux |
giggls
commented
Aug 17, 2016
|
As I already wrote, the problem does not seem to be with the content of /proc/stat but with the fact that for some reason the loop terminates before btime has been read. If I replace /proc/stat in the code by a file "stat.txt" which I created using "cat /proc/stat >stat.txt" everything works fine. |
giggls
commented
Aug 17, 2016
|
/proc/stat from inside and outside container. |
|
I believe you... I was looking for some sort of empty line or something that might explain this. As I said, 4.6 kernel in ubuntu 16.10 doesn't do this - ps ux works fine there. The two .txt files you appended are identical when wget'ed. So I'm sure there' something lxcfs is doing differently but I don't yet know what. |
giggls
commented
Aug 17, 2016
|
strace output looks somewhat strange inside the container:
The 4096 seems to be crap IMO Outside:
|
giggls
commented
Aug 17, 2016
•
|
Aah wait, the second read is the problem, not the 4096 Why is this 0 and not 418? |
giggls commentedAug 9, 2016
Hello,
I'm using lxcfs (version 2.0.2 from debian-backports) on a Debian stable host running a vanilla Kernel (v 4.6.5).
Unfortunately I get "no btime in /proc/stat" inside all of my containers (Debian 7.x and 8.x).
I extracted the code in Question from procps sources, because btime does actually exist in /proc/stat (verified using
grep btime /proc/stat.).Digging further I found that fgets (see the code below) gives me zero bytes after reading "intr ..." which quits the while loop before btime has actually been reached.
So the bug in lxfs seems to be, that ps assumes, that fgets will never return zero until EOF of /proc/stat is reached. Unfortunately lxfs does not seem to make shure, that this assumption is always true.
Here is the code snippet from ps I have been using to debug this: