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
fix data race in kubelet volume test: add lock for ut #104069
Conversation
/assign @manugupt1 |
@SergeyKanzhelev: GitHub didn't allow me to assign the following users: manugupt1. Note that only kubernetes members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
pkg/kubelet/pod_workers_test.go
Outdated
@@ -105,6 +105,11 @@ func (f *fakePodWorkers) ShouldPodRuntimeBeRemoved(uid types.UID) bool { | |||
defer f.statusLock.Unlock() | |||
return f.removeRuntime[uid] | |||
} | |||
func (f *fakePodWorkers) SetPodRuntimeBeRemoved(uid types.UID) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PodWorkers interface does not set SetPodRuntimeBeRemoved
.
Does it make sense for this to be a private implementation?
f.setPodRuntimeBeRemoved
Another question for my own understanding; is what happens in the original implementation? Does this wait for volumes to be unmounted (I understand its in the comments, but wanted to double check).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To fix it gracefully, I think we need to use something like waitForVolumeUnmount
to wait for fake unmount.
SetPodRuntimeBeRemoved
is more like unmount runtime by test itself
I only fixed the thread-safe problem for current logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
17a3e47
to
0903584
Compare
/lgtm |
@manugupt1: changing LGTM is restricted to collaborators In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should fix the race condition
/lgtm
WARNING: DATA RACE
Write at 0x00c00080eae8 by goroutine 113:
k8s.io/kubernetes/pkg/kubelet.TestVolumeUnmountAndDetachControllerDisabled()
/home/sharmaad/go/src/k8s.io/kubernetes/pkg/kubelet/kubelet_volumes_test.go:319 +0xc73
testing.tRunner()
/usr/local/go/src/testing/testing.go:1193 +0x202
Previous read at 0x00c00080eae8 by goroutine 132:
k8s.io/kubernetes/pkg/kubelet.(*fakePodWorkers).ShouldPodRuntimeBeRemoved()
/home/sharmaad/go/src/k8s.io/kubernetes/pkg/kubelet/pod_workers_test.go:106 +0xbc
/assign @mrunalp |
Signed-off-by: Paco Xu <paco.xu@daocloud.io> Co-authored-by: Jian Zeng <zengjian.zj@bytedance.com>
0903584
to
ab055e9
Compare
/lgtm |
/triage accepted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/assign mrunalp |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mrunalp, pacoxu, SergeyKanzhelev 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 |
/kind flake
Fixes #104057