-
Notifications
You must be signed in to change notification settings - Fork 39.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
Flaky test failure in staging/src/k8s.io/client-go/util/workqueue #125581
Comments
/sig api-machinery |
Is that reproducible for you with x/tools/stress?
Edit: I got it after a couple thousand runs
|
/triage accepted |
@tatsuhiro-t Your fix makes sense, are you planning on sending a PR? Thanks. |
/assign |
Just preassigning, if you want to work on it let me know. |
/kind flake |
/remove-kind bug |
Yes, let me work on this issue. I have not tried x/tools/stress. Lots of trials are needed to reproduce it. |
Thanks. I don't think -race is required to reproduce the issue. The race instrumentation might slow the runtime down just enough for this to reproduce more easier. I had better luck reproducing with
/assign tatsuhiro-t |
Yeah, I used -race to save the number of runs and time. |
What happened?
What did you expect to happen?
Tests always succeed
How can we reproduce it (as minimally and precisely as possible)?
Run
Repeat until it fails.
Anything else we need to know?
If
FakeClock.Step
is called after https://github.com/kubernetes/client-go/blob/d2f5fba1f82d119e09288c70ce87bccb3dc119e4/util/workqueue/delaying_queue.go#L279 and before https://github.com/kubernetes/client-go/blob/d2f5fba1f82d119e09288c70ce87bccb3dc119e4/util/workqueue/delaying_queue.go#L300,the created timer fires at
entry.readyAt.Sub(now) + FakeClock.time
that has been adjusted byFakeClock.Step
.Because we do not call
FakeClock.Step
with the positive duration anymore, this timer never fire. Notenow
is theFakeClock.time
before it is adjusted byFakeClock.Step
.The proposed fix is as follows.
First add
NewDeadlineTimer(t *time.Time) Timer
tok8s.io/utils/clock.Clock
, which fires at the givent
.Second, replace NewTimer with NewDeadlineTimer at https://github.com/kubernetes/client-go/blob/d2f5fba1f82d119e09288c70ce87bccb3dc119e4/util/workqueue/delaying_queue.go#L300
Finally, call
FakeClock.Step(0)
at https://github.com/kubernetes/client-go/blob/d2f5fba1f82d119e09288c70ce87bccb3dc119e4/util/workqueue/delaying_queue_test.go#L234 so that FakeClock deals with waiters.Kubernetes version
Cloud provider
OS version
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, ...) and versions (if applicable)
The text was updated successfully, but these errors were encountered: