Merge pull request #26387 from MHBauer/cleanupjitter

Automatic merge from submit-queue

close channel to prevent buildup of wait.JitterUntil()

<!--
Checklist for submitting a Pull Request

Please remove this comment block before submitting.

1. Please read our [contributor guidelines](https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md).
2. See our [developer guide](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md).
3. If you want this PR to automatically close an issue when it is merged,
   add `fixes #<issue number>` or `fixes #<issue number>, fixes #<issue number>`
   to close multiple issues (see: https://github.com/blog/1506-closing-issues-via-pull-requests).
4. Follow the instructions for [labeling and writing a release note for this PR](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes) in the block below.
-->

Trying to look at flake in #26377 by running the test with large counts of runs. It was timing out because a `wait.JitterUntil` goroutine builds up for each of the four tests. So if you ran it a thousand times, you would end up with 4k goroutines spinning in the background. Now I create a channel and close it at the end of each test to prevent a memory leak.
pull/6/head
k8s-merge-robot 2016-07-11 18:53:39 -07:00 committed by GitHub
commit 7b067c859f
2 changed files with 13 additions and 5 deletions

View File

@ -126,7 +126,7 @@ func (rc *reconciler) reconciliationLoopFunc() func() {
err)
}
} else {
// If volume is not safe to detach (is mounted) wait a max amount of time before detaching any way.
// If volume is not safe to detach (is mounted) wait a max amount of time before detaching anyway.
if timeElapsed > rc.maxWaitForUnmountDuration {
glog.V(5).Infof("Attempting to start DetachVolume for volume %q from node %q. Volume is not safe to detach, but maxWaitForUnmountDuration expired.", attachedVolume.VolumeName, attachedVolume.NodeName)
err := rc.attacherDetacher.DetachVolume(attachedVolume.AttachedVolume, false /* verifySafeToDetach */, rc.actualStateOfWorld)

View File

@ -55,7 +55,9 @@ func Test_Run_Positive_DoNothing(t *testing.T) {
reconcilerLoopPeriod, maxWaitForUnmountDuration, dsw, asw, ad, nsu)
// Act
go reconciler.Run(wait.NeverStop)
ch := make(chan struct{})
go reconciler.Run(ch)
defer close(ch)
// Assert
waitForNewAttacherCallCount(t, 0 /* expectedCallCount */, fakePlugin)
@ -97,7 +99,9 @@ func Test_Run_Positive_OneDesiredVolumeAttach(t *testing.T) {
}
// Act
go reconciler.Run(wait.NeverStop)
ch := make(chan struct{})
go reconciler.Run(ch)
defer close(ch)
// Assert
waitForNewAttacherCallCount(t, 1 /* expectedCallCount */, fakePlugin)
@ -140,7 +144,9 @@ func Test_Run_Positive_OneDesiredVolumeAttachThenDetachWithUnmountedVolume(t *te
}
// Act
go reconciler.Run(wait.NeverStop)
ch := make(chan struct{})
go reconciler.Run(ch)
defer close(ch)
// Assert
waitForNewAttacherCallCount(t, 1 /* expectedCallCount */, fakePlugin)
@ -204,7 +210,9 @@ func Test_Run_Positive_OneDesiredVolumeAttachThenDetachWithMountedVolume(t *test
}
// Act
go reconciler.Run(wait.NeverStop)
ch := make(chan struct{})
go reconciler.Run(ch)
defer close(ch)
// Assert
waitForNewAttacherCallCount(t, 1 /* expectedCallCount */, fakePlugin)