-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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 for Test_Run_Positive_VolumeMountControllerAttachEnabledRace #103353
Conversation
Hi @njuptlzf. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
@@ -1834,7 +1835,6 @@ func Test_Run_Positive_VolumeMountControllerAttachEnabledRace(t *testing.T) { | |||
fakePlugin.UnmountDeviceHook = func(mountPath string) error { | |||
// Act: | |||
// 3. While a volume is being unmounted, add it back to the desired state of world | |||
t.Logf("UnmountDevice called") |
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.
WARNING: DATA RACE
Read at 0x00c000547cc3 by goroutine 85:
testing.(*common).logDepth()
/root/tools/go1163/src/testing/testing.go:759 +0x164
testing.(*common).log()
/root/tools/go1163/src/testing/testing.go:746 +0x8f
testing.(*common).Logf()
/root/tools/go1163/src/testing/testing.go:792 +0x21
k8s.io/kubernetes/pkg/kubelet/volumemanager/reconciler.Test_Run_Positive_VolumeMountControllerAttachEnabledRace.func2()
/root/workspace/kubernetes/pkg/kubelet/volumemanager/reconciler/reconciler_test.go:1837 +0xea
k8s.io/kubernetes/pkg/volume/testing.(*FakeVolume).UnmountDevice()
/root/workspace/kubernetes/pkg/volume/testing/testing.go:1101 +0x154
k8s.io/kubernetes/pkg/volume/util/operationexecutor.(*operationGenerator).GenerateUnmountDeviceFunc.func1()
/root/workspace/kubernetes/pkg/volume/util/operationexecutor/operation_generator.go:936 +0x41b
k8s.io/kubernetes/pkg/volume/util/types.(*GeneratedOperations).Run()
/root/workspace/kubernetes/pkg/volume/util/types/types.go:79 +0x195
k8s.io/kubernetes/pkg/volume/util/nestedpendingoperations.(*nestedPendingOperations).Run.func1()
/root/workspace/kubernetes/pkg/volume/util/nestedpendingoperations/nestedpendingoperations.go:183 +0x159
Previous write at 0x00c000547cc3 by main goroutine:
testing.tRunner.func1()
/root/tools/go1163/src/testing/testing.go:1180 +0x52c
testing.tRunner()
/root/tools/go1163/src/testing/testing.go:1197 +0x22a
testing.runTests()
/root/tools/go1163/src/testing/testing.go:1509 +0x612
testing.(*M).Run()
/root/tools/go1163/src/testing/testing.go:1417 +0x3b3
main.main()
_testmain.go:73 +0x236
Goroutine 85 (running) created at:
k8s.io/kubernetes/pkg/volume/util/nestedpendingoperations.(*nestedPendingOperations).Run()
/root/workspace/kubernetes/pkg/volume/util/nestedpendingoperations/nestedpendingoperations.go:178 +0x572
k8s.io/kubernetes/pkg/volume/util/operationexecutor.(*operationExecutor).UnmountDevice()
/root/workspace/kubernetes/pkg/volume/util/operationexecutor/operation_executor.go:905 +0x2d3
k8s.io/kubernetes/pkg/kubelet/volumemanager/reconciler.(*reconciler).unmountDetachDevices()
/root/workspace/kubernetes/pkg/kubelet/volumemanager/reconciler/reconciler.go:302 +0x3e3
k8s.io/kubernetes/pkg/kubelet/volumemanager/reconciler.(*reconciler).reconcile()
/root/workspace/kubernetes/pkg/kubelet/volumemanager/reconciler/reconciler.go:177 +0x54
k8s.io/kubernetes/pkg/kubelet/volumemanager/reconciler.(*reconciler).reconciliationLoopFunc.func1()
/root/workspace/kubernetes/pkg/kubelet/volumemanager/reconciler/reconciler.go:151 +0x5b
k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1()
/root/workspace/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:155 +0x75
k8s.io/apimachinery/pkg/util/wait.BackoffUntil()
/root/workspace/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:156 +0xba
k8s.io/apimachinery/pkg/util/wait.JitterUntil()
/root/workspace/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:133 +0x114
k8s.io/apimachinery/pkg/util/wait.Until()
/root/workspace/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:90 +0x8e
k8s.io/kubernetes/pkg/kubelet/volumemanager/reconciler.(*reconciler).Run()
/root/workspace/kubernetes/pkg/kubelet/volumemanager/reconciler/reconciler.go:146 +0x2f
==================
fix DATA RACE of tesing.t
for https://github.com/golang/go/blob/d19a53338fa6272b4fe9c39d66812a79e1464cd2/src/testing/testing.go#L1237-L1238
/ok-to-test |
Befor this pr: # ./stress -p 300 ./reconciler.test -test.run "Test_Run_Positive_VolumeMountControllerAttachEnabledRace"
2h16m30s: 1089927 runs so far, 73 failures (0.01%)
/tmp# find /tmp/go-stress-20210701T014412* -type f |xargs grep "DATA"
/tmp/go-stress-20210701T014412-033946034:WARNING: DATA RACE
/tmp/go-stress-20210701T014412-213477365:WARNING: DATA RACE
/tmp/go-stress-20210701T014412-400779095:WARNING: DATA RACE
/tmp/go-stress-20210701T014412-512170394:WARNING: DATA RACE
/tmp/go-stress-20210701T014412-809148112:WARNING: DATA RACE After this pr: # ./stress -p 300 ./reconciler.test -test.run "Test_Run_Positive_VolumeMountControllerAttachEnabledRace"
1h35m25s: 783657 runs so far, 35 failures (0.00%)
# find /tmp/go-stress-20210630T172003* -type f |xargs grep "DATA"
# Other problems are all because of
It should be |
Does this need to enter the 1.22 milestone? @BenTheElder |
/lgtm |
/triage accepted |
/remove-kind failing-test |
/lgtm |
@@ -1861,5 +1861,5 @@ func Test_Run_Positive_VolumeMountControllerAttachEnabledRace(t *testing.T) { | |||
dsw.DeletePodFromVolume(podName, generatedVolumeName) |
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.
Does this need to use the original name too?
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.
I’m not an expert in volume, and it may take time to investigate.
But there is no data race here in the stress test.
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.
Actually no need, because dsw.DeletePodFromVolume(podName, generatedVolumeName)
runs before UnmountDeviceHook
, use generatedVolumeNameCopy maybe still a good change
/test pull-kubernetes-integration |
the fix looks good. |
/lgtm Thank you! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: msau42, njuptlzf 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 |
Thanks! |
What type of PR is this?
/kind flake
/kind failing-test
What this PR does / why we need it:
fix the DATA RACE of
generatedVolumeName
.fix the DATA RACE of
testing.t
.Which issue(s) this PR fixes:
Fixes #102932
Special notes for your reviewer:
NONE
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:
I can reproduce it by
./stress -p 300 ./reconciler.test -test.run "Test_Run_Positive_VolumeMountControllerAttachEnabledRace"