-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
filesystem usage stats are wrong in v2 api #1395
Conversation
Good catch. LGTM |
Thanks... it took most of my afternoon to track down ;-) I need 🍻 |
We need to improve testing around the critical APIs.. |
Lol. Yeah. Time for 🍻 🍻 |
@derekwaynecarr Sorry for being dense but could you explain the problem & how this fixes it? Got so much to learn! |
@jimmidyson The problem is that Go reuses the memory for the object in a range clause, and the for loop is taking the address of some fields on that struct:
This means that every machine stats's |
Aha thanks @timstclair! |
@derekwaynecarr: do you know by any chance if this fix made its way into |
Nope. Kubernetes v1.3.5 shipped with cAdvisor v0.23.7. This change was recently cherrypicked into the v0.23 branch, but hasn't been cherrypicked into Kubernetes yet. |
Go reuses memory, so the result was that things that took the pointer value of
stat
would get a random result from a differentfilesystem
for available, capacity, etc. It caused the output of/v2.1/machinestats
to just be really wrong and confusing ;-)/cc @ronnielai @vishh @timstclair @ncdc @pmorie