Skip to content
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

check if Memory is not nil for container stats #77656

Merged
merged 1 commit into from
May 10, 2019

Conversation

yastij
Copy link
Member

@yastij yastij commented May 9, 2019

/kind bug
/sig node
What this PR does / why we need it:

Which issue(s) this PR fixes: Fixes #77655

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Check if container memory stats are available before accessing it

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. sig/node Categorizes an issue or PR as relevant to SIG Node. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/kubelet labels May 9, 2019
@yastij
Copy link
Member Author

yastij commented May 9, 2019

/priority critical-urgent

@k8s-ci-robot k8s-ci-robot added priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels May 9, 2019
@yastij
Copy link
Member Author

yastij commented May 9, 2019

/cc @tallclair

Copy link
Contributor

@mattjmcnaughton mattjmcnaughton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Nice work here :)

I'm curious. do you think its worth adding a unit test ensuring that we don't panic when cstat.Memory is nil? That'd also give me slightly more confidence that this lack of nil check was the cause of the error this pr claims to fix.

Additionally, for more own understanding, can you share more about why cstat.Memory would sometimes be nil? Do we want to address the times when cstat.Memory is nil?

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 9, 2019
@mattjmcnaughton
Copy link
Contributor

/assign @dchen1107

@mattjmcnaughton
Copy link
Contributor

Also, we can talk about this once its merged, but this seems like a good candidate for cherry picking to earlier releases.

Copy link
Member

@neolit123 neolit123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @yastij

/lgtm
/assign @yujuhong

@yastij
Copy link
Member Author

yastij commented May 9, 2019

I’ll also raise an issue to increase test coverage for some parts related to cadvisor in the kubelet.

@tallclair
Copy link
Member

/approve
/cc @dashpole

@k8s-ci-robot k8s-ci-robot requested a review from dashpole May 9, 2019 22:39
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tallclair, yastij

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 9, 2019
@dashpole
Copy link
Contributor

dashpole commented May 9, 2019

/lgtm

@yastij
Copy link
Member Author

yastij commented May 9, 2019

@mattjmcnaughton - when getting stats for docker for example (or libcontainer in general) cadvisor talks to a cgroupManager IIRC (e.g. cgroupfs).
When opening the memory.stat file if it dosent exist we return just nil with no err, leading the cgroupManager to not error, and thus having stat with a nil memory.
On my cluster this was the issue, but another logic can lead to something like this I think

@k8s-ci-robot k8s-ci-robot merged commit ef9e794 into kubernetes:master May 10, 2019
@yastij yastij deleted the check-cstat-mem branch May 10, 2019 06:12
k8s-ci-robot added a commit that referenced this pull request May 10, 2019
…-upstream-release-1.14

Automated cherry pick of #77656: check if Memory is not nil for container stats
k8s-ci-robot added a commit that referenced this pull request May 14, 2019
…-upstream-release-1.12

Automated cherry pick of #77656: check if Memory is not nil for container stats
k8s-ci-robot added a commit that referenced this pull request May 21, 2019
…-upstream-release-1.13

Automated cherry pick of #77656: check if Memory is not nil for container stats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubelet cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/node Categorizes an issue or PR as relevant to SIG Node. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kubelet crashing with SIGSEGV under load
8 participants