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

Use no-priority best-effort pod as the preemptor in BenchmarkGetPodsToPreempt #78057

Closed
wants to merge 1 commit into from

Conversation

tedyu
Copy link
Contributor

@tedyu tedyu commented May 17, 2019

What type of PR is this?
/kind bug

What this PR does / why we need it:
I see the following when running BenchmarkGetPodsToPreempt :

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x280 pc=0x1d2f91a]

goroutine 10 [running]:
k8s.io/kubernetes/pkg/kubelet/types.IsCriticalPod(0x0, 0x1019ace)
	/Users/yute/go-workspace/src/k8s.io/kubernetes/pkg/kubelet/types/pod_update.go:150 +0x5a
k8s.io/kubernetes/pkg/kubelet/types.Preemptable(0x0, 0xc000158380, 0x20b1d69)
	/Users/yute/go-workspace/src/k8s.io/kubernetes/pkg/kubelet/types/pod_update.go:165 +0x2f
k8s.io/kubernetes/pkg/kubelet/preemption.sortPodsByQOS(0x0, 0xc0000a0400, 0x6e, 0x80, 0x0, 0x203000, 0x203000, 0xc0000a0400, 0x11c4d5a, 0x6e, ...)
	/Users/yute/go-workspace/src/k8s.io/kubernetes/pkg/kubelet/preemption/preemption.go:231 +0xdf
k8s.io/kubernetes/pkg/kubelet/preemption.getPodsToPreempt(0x0, 0xc0000a0400, 0x6e, 0x80, 0xc00007cf48, 0x1, 0x1, 0x80, 0x1d045458, 0x1d04545800000000, ...)
	/Users/yute/go-workspace/src/k8s.io/kubernetes/pkg/kubelet/preemption/preemption.go:119 +0x6a
k8s.io/kubernetes/pkg/kubelet/preemption.BenchmarkGetPodsToPreempt(0xc00013e1a0)
	/Users/yute/go-workspace/src/k8s.io/kubernetes/pkg/kubelet/preemption/preemption_test.go:153 +0x1b2

This PR fixes the panic by using no-priority best-effort pod as the preemptor in BenchmarkGetPodsToPreempt.

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 17, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: tedyu
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: vishh

If they are not already assigned, you can assign the PR to them by writing /assign @vishh in a comment when ready.

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 area/kubelet sig/node Categorizes an issue or PR as relevant to SIG Node. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels May 17, 2019
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.

Thanks for adding this protection :)

/lgtm

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

tedyu commented May 23, 2019

ping @sjenning for review

@sjenning
Copy link
Contributor

sjenning commented Jun 6, 2019

seems like there is a deeper issue here. why is it being called with a nil pod on this code path. seems like that shouldn't happen.

if we do this, we also need to protect line 155

@sjenning
Copy link
Contributor

sjenning commented Jun 6, 2019

yeah, i think we need to change BenchmarkGetPodsToPreempt to pass a simple no-priority best-effort pod as the preemptor here
https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/preemption/preemption_test.go#L153

@tedyu tedyu changed the title Check pod not being nil in IsCriticalPod Use no-priority best-effort pod as the preemptor in BenchmarkGetPodsToPreempt Jun 6, 2019
@tedyu
Copy link
Contributor Author

tedyu commented Jun 6, 2019

Superceded by #78777

@tedyu tedyu closed this Jun 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. 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.

None yet

4 participants