-
Notifications
You must be signed in to change notification settings - Fork 39.8k
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 a racing issue in client-go UpdateTransportConfig #80284
Conversation
@danielqsj is it possible to add some tests so that these kind of bugs wont happen in future ? |
/cc @jpbetz |
@danielqsj Thanks for finding this. Just to confirm, are all of the other functions in this file correct? I did a quick pass and they all look okay, but it would be great if you'd check it carefully as well. |
@jpbetz Other functions in this file look good. |
/retest |
/lgtm Thanks for fixing this! |
Add sig-auth approvers for approving. |
This looks ok, but would like to refer it back to the linked bug. /approve |
staging/src/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go
Outdated
Show resolved
Hide resolved
/hold |
I'd also like to see a test demonstrating the bug this is fixing, if possible |
@liggitt thanks for your reviewing. PR updated but I have not find an easy way to write this test case immediately. |
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 have not find an easy way to write this test case
I would expect a unit test that starts two goroutines that do the following and lets them run for a few seconds would probably demonstrate the bug on master:
- make requests in a loop
- call UpdateTransportConfig in a loop
staging/src/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go
Outdated
Show resolved
Hide resolved
staging/src/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go
Outdated
Show resolved
Hide resolved
/milestone v1.17 (issue #80269 is in 1.17, PR was not) |
@danielqsj Will this likely be merged by this Thursday, 5PM pacific time and close the referenced issue? Otherwise, should we move it and the related issue to v1.18? |
@liggitt I add a test case, but I cannot reproduce this issues by it. Need your help. Thanks |
staging/src/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go
Outdated
Show resolved
Hide resolved
staging/src/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go
Outdated
Show resolved
Hide resolved
staging/src/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go
Outdated
Show resolved
Hide resolved
@liggitt thanks, PR updated, PTAL |
staging/src/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go
Outdated
Show resolved
Hide resolved
staging/src/k8s.io/client-go/plugin/pkg/client/auth/exec/exec_test.go
Outdated
Show resolved
Hide resolved
staging/src/k8s.io/client-go/plugin/pkg/client/auth/exec/exec_test.go
Outdated
Show resolved
Hide resolved
a few small final comments, then squash down to a single commit |
@liggitt great thanks. PR updated and squashed. :) |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: danielqsj, liggitt, mikedanese 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 |
/retest |
What type of PR is this?
/kind bug
/sig api-machinery
What this PR does / why we need it:
in
k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go
UpdateTransportConfig()
, this assignment statement will cause data race.kubernetes/staging/src/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go
Line 194 in 5de4134
Need acquire lock before to avoid it.
Which issue(s) this PR fixes:
Fixes #80269
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: