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

Fix race in attachdetach tests #102584

Merged
merged 1 commit into from Jun 4, 2021

Conversation

liggitt
Copy link
Member

@liggitt liggitt commented Jun 4, 2021

What type of PR is this?

/kind bug
/kind failing-test
/kind flake

What this PR does / why we need it:

Fixes #102476

The fake client already locks before invoking reactors. The issue was that package variables were shared between clients constructed in multiple tests.

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. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. kind/flake Categorizes issue or PR as related to a flaky test. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jun 4, 2021
@k8s-ci-robot k8s-ci-robot added sig/apps Categorizes an issue or PR as relevant to SIG Apps. approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jun 4, 2021
@liggitt
Copy link
Member Author

liggitt commented Jun 4, 2021

with this PR:

go test k8s.io/kubernetes/pkg/controller/volume/attachdetach -race -c
$ stress ./attachdetach.test 
0 runs so far, 0 failures
0 runs so far, 0 failures
12 runs so far, 0 failures
12 runs so far, 0 failures
12 runs so far, 0 failures
24 runs so far, 0 failures
24 runs so far, 0 failures
36 runs so far, 0 failures
36 runs so far, 0 failures
48 runs so far, 0 failures
48 runs so far, 0 failures
48 runs so far, 0 failures
60 runs so far, 0 failures
60 runs so far, 0 failures
72 runs so far, 0 failures
72 runs so far, 0 failures
72 runs so far, 0 failures
84 runs so far, 0 failures
84 runs so far, 0 failures
96 runs so far, 0 failures
96 runs so far, 0 failures
100 runs so far, 0 failures
108 runs so far, 0 failures
108 runs so far, 0 failures
120 runs so far, 0 failures
120 runs so far, 0 failures
132 runs so far, 0 failures
132 runs so far, 0 failures

on master:

go test k8s.io/kubernetes/pkg/controller/volume/attachdetach -race -c
[liggitt@liggitt-macbookpro2 kubernetes]$ stress ./attachdetach.test 
0 runs so far, 0 failures
0 runs so far, 0 failures

/var/folders/7f/9xt_73f12xlby0w362rgk0s400kjgb/T/go-stress-20210604T020123-998362595
I0604 02:01:24.923192   49752 shared_informer.go:240] Waiting for caches to sync for attach detach
I0604 02:01:25.027803   49752 shared_informer.go:247] Caches are synced for attach detach 
I0604 02:01:25.034202   49752 reconciler.go:219] attacherDetacher.DetachVolume started for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-4" 
I0604 02:01:25.034330   49752 operation_generator.go:1483] Verified volume is safe to detach for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-4" 
I0604 02:01:25.034399   49752 operation_generator.go:483] DetachVolume.Detach succeeded for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-4" 
I0604 02:01:25.034932   49752 reconciler.go:219] attacherDetacher.DetachVolume started for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode" 
I0604 02:01:25.035088   49752 operation_generator.go:1483] Verified volume is safe to detach for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode" 
I0604 02:01:25.035635   49752 operation_generator.go:483] DetachVolume.Detach succeeded for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode" 
I0604 02:01:25.037115   49752 reconciler.go:219] attacherDetacher.DetachVolume started for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-1" 
I0604 02:01:25.037136   49752 operation_generator.go:1483] Verified volume is safe to detach for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-1" 
I0604 02:01:25.037195   49752 operation_generator.go:483] DetachVolume.Detach succeeded for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-1" 
I0604 02:01:25.037899   49752 reconciler.go:219] attacherDetacher.DetachVolume started for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-2" 
I0604 02:01:25.038004   49752 operation_gen
…

/var/folders/7f/9xt_73f12xlby0w362rgk0s400kjgb/T/go-stress-20210604T020123-025114086
I0604 02:01:24.925197   49759 shared_informer.go:240] Waiting for caches to sync for attach detach
I0604 02:01:25.030851   49759 shared_informer.go:247] Caches are synced for attach detach 
I0604 02:01:25.038544   49759 reconciler.go:219] attacherDetacher.DetachVolume started for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-2" 
I0604 02:01:25.038685   49759 operation_generator.go:1483] Verified volume is safe to detach for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-2" 
I0604 02:01:25.038777   49759 operation_generator.go:483] DetachVolume.Detach succeeded for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-2" 
I0604 02:01:25.040317   49759 reconciler.go:219] attacherDetacher.DetachVolume started for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-3" 
I0604 02:01:25.040353   49759 operation_generator.go:1483] Verified volume is safe to detach for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-3" 
I0604 02:01:25.040414   49759 operation_generator.go:483] DetachVolume.Detach succeeded for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-3" 
I0604 02:01:25.041236   49759 reconciler.go:219] attacherDetacher.DetachVolume started for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-4" 
I0604 02:01:25.041318   49759 operation_generator.go:1483] Verified volume is safe to detach for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-4" 
I0604 02:01:25.041395   49759 operation_generator.go:483] DetachVolume.Detach succeeded for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-4" 
I0604 02:01:25.042277   49759 reconciler.go:219] attacherDetacher.DetachVolume started for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode" 
I0604 02:01:25.042379   49759 operation
…

/var/folders/7f/9xt_73f12xlby0w362rgk0s400kjgb/T/go-stress-20210604T020123-164246541
I0604 02:01:24.930906   49754 shared_informer.go:240] Waiting for caches to sync for attach detach
I0604 02:01:25.035145   49754 shared_informer.go:247] Caches are synced for attach detach 
I0604 02:01:25.043819   49754 reconciler.go:219] attacherDetacher.DetachVolume started for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-3" 
I0604 02:01:25.043934   49754 operation_generator.go:1483] Verified volume is safe to detach for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-3" 
I0604 02:01:25.044018   49754 operation_generator.go:483] DetachVolume.Detach succeeded for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-3" 
I0604 02:01:25.044950   49754 reconciler.go:219] attacherDetacher.DetachVolume started for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-4" 
I0604 02:01:25.045025   49754 operation_generator.go:1483] Verified volume is safe to detach for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-4" 
I0604 02:01:25.045116   49754 operation_generator.go:483] DetachVolume.Detach succeeded for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-4" 
I0604 02:01:25.046231   49754 reconciler.go:219] attacherDetacher.DetachVolume started for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode" 
I0604 02:01:25.046767   49754 operation_generator.go:1483] Verified volume is safe to detach for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode" 
I0604 02:01:25.046886   49754 operation_generator.go:483] DetachVolume.Detach succeeded for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode" 
I0604 02:01:25.049236   49754 reconciler.go:219] attacherDetacher.DetachVolume started for volume "nil" (UniqueName: "kubernetes.io/testPlugin/lostVolumeName") on node "mynode-1" 
I0604 02:01:25.049300   49754 operation_gen
…
12 runs so far, 3 failures

Copy link
Member

@cblecker cblecker left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 4, 2021
@BenTheElder
Copy link
Member

/triage accepted
/priority important-soon

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jun 4, 2021
@BenTheElder
Copy link
Member

why did this get labeled sig apps??
/sig storage
/remove-sig apps

@k8s-ci-robot k8s-ci-robot added sig/storage Categorizes an issue or PR as relevant to SIG Storage. and removed sig/apps Categorizes an issue or PR as relevant to SIG Apps. labels Jun 4, 2021
@BenTheElder
Copy link
Member

#70596

🤨

@cndoit18
Copy link
Member

cndoit18 commented Jun 4, 2021

/test pull-kubernetes-e2e-gce-ubuntu-containerd

@dims
Copy link
Member

dims commented Jun 4, 2021

/approve
/lgtm

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cblecker, dims, liggitt

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
Copy link
Contributor

@liggitt: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-kubernetes-integration ca279bb link /test pull-kubernetes-integration

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@cndoit18
Copy link
Member

cndoit18 commented Jun 4, 2021

/test pull-kubernetes-integration

@k8s-ci-robot k8s-ci-robot merged commit e4448f2 into kubernetes:master Jun 4, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.22 milestone Jun 4, 2021
@liggitt liggitt deleted the attachdetach-race branch June 14, 2021 12:39
k8s-ci-robot added a commit that referenced this pull request Jun 22, 2021
…584-upstream-release-1.21

Automated cherry pick of #102584: Fix race in attachdetach tests
k8s-ci-robot added a commit that referenced this pull request Jul 28, 2021
…584-upstream-release-1.20

Automated cherry pick of #102584: Fix race in attachdetach tests
k8s-ci-robot added a commit that referenced this pull request Jul 28, 2021
…584-upstream-release-1.19

Automated cherry pick of #102584: Fix race in attachdetach tests
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. kind/flake Categorizes issue or PR as related to a flaky test. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/storage Categorizes an issue or PR as relevant to SIG Storage. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failing tests: [sig-storage] Test_ADC_VolumeAttachmentRecovery/Deleted_Pod_with_migrated_PV
6 participants